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
Post a Comment