I have a strange problem which I cannot get my head around, I have created a sticky nav via jquery which works fine in all browsers but Chrome and Safari, sometimes it works and sometimes it doesn’t if you refresh the page. Most of the time the menu jumps to the top of the page as soon as you start browsing. You can view the problem here: http://debourg-dev.ch/syselcloud/syselbackup/
var yOffset = $(“#local-nav-wrapper”).position().top; seems to make it a bit more reliable in webkit, but the menu still jumps a bit before it’s supposed to. I can’t give a set offset like 444 as the layout is responsive.
In fact it still causes the original problem when I upload it to the server, it appears to be more reliable on localhost. I can’t get my head around this. Everything is the same between localhost and my server?
sounds like a timing problem. When it loads in localhost it’s really fast anad it gets the correct value, but on the server it gets the value before the elements are set.
you could move the function from $(document).ready to $(window).load but that would make a strange jumping effect on the menu if a user starts scrolling immediately after the page shows up. Anyway I think it’s worth giving it a try