0
Changing css according to scroll using JavaScript or jQuery!
I have seen many examples of changing CSS styles according to scrolling. I have tried many times to do so but never been able to do it dynamically like just every little bit of scroll would change a bit of CSS styles. Can anyone pls share the code for this thing with a bit of explaination?
2 Réponses
+ 14
onload = function() {
document.body.style.height = "300%";
document.body.style.background = "black";
};
onscroll = function() {
document.body.style.background = "#"+Math.round(scrollY*(255/(innerHeight*2))).toString(16)+"0000";
};
//Scroll page up and down
+ 1
Thanx man