javascript - Navigation with different background color when is on top -


i working on little project , have navigation transparent background. need if start scrolling, background change on black.

my code:

window.onscroll = function f() {     if (document.documentelement.scrolltop + document.body.scrolltop > prvni.parentnode.offsettop        ) {         nav.style.display = "none";     }     else {         nav.style.display = "block";     } } 


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -