DEV Community

Discussion on: Hide NavBar as Scroll down, in less than 10 lines of javascript;

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

I think it needs some refinement - you lose the menu if you scroll down so much as 1 pixel. Similar functionality on websites is more complex than this

Collapse
 
areeburrub profile image
Areeb ur Rub

Right, it can be conplex but it's the simplest way to do so.

Collapse
 
hasnaindev profile image
Muhammad Hasnain • Edited

I agree with Areeb. You could write an entire library just to handle the navigation bar and add more complexity but I don't think that's the point. Most of the posts here are written by beginners, for beginners.

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Well, you could add one or two lines to stop it disappearing when you scroll as little as one pixel down, which is just plain irritating for the the user