javascript - Hiding visibility hides image but still reveals space taken by hidden element -


a fixed navbar appears when user scrolls past logo in header(100vh). (the point @ switch happens @ 220px scrolltop.) making use of javascript's .visibility: hidden/visible, works desired in jsfiddle

on localhost, however, works once navbar appears @ 220px, remainder of header(100vh minus 200px) shows below navbar white(only image hidden). issue be?

the code on localhost same in fiddle & there no console errors.

would add i'm not using jquery because causes conflict item using jquery inspite of using jquery.noconflict();.

that's element.visibility=visible|hidden; do. it's make object invisible reserve space.

and different element.display=block|none;, hiding element , remove space.

i altered example display:none/block : https://jsfiddle.net/qz7531bu/62

and problem of nav disappear, because it's inside header. move out it's should fine : https://jsfiddle.net/qz7531bu/63


Comments