0
I want to change the color of the scroll bar only when the user scrolls the screen. I tried the code below but it didn’t work. How do I?
$('body').scroll(function(){
setTimeout(function(){
$("body::-webkit-scrollbar").css("background-color", "#333");
console.log('fsdfs');
},500);
});
You cannot manipulate pseudo-elements
::-webkit-scrollbar
using jquery– Sveen
Use a class in the CSS
.body.customScroll
and with the jQuery you use$("body").addClass("customScroll")
– Valdeir Psr
Felipe, if the answer solved the problem, it is important to mark . Read the page Tour to know how the site system is. Obg!
– Sam