Firefox jumps after scrollTo(value) and after animate({scrollTo:value})
Hello. I'm using smooth scroll function to scrol to selected ID (if page is loaded with hash parameter) or if someone clicked to href="#name" type anchor... On every browser everything works well, but on MF won't.... I have sticky menu, so the value which i want scroll to is decreased by sticky menu height...
my entire JS code (located in scripts.js) for doing that is:
var jump = function (e) { if (e) { e.preventDefault(); var target = $(this).attr("href"); } else { var target = location.hash; } $('html,body').animate({ scrollTop: $(target).offset().top - $('.nav-bg').height() }, 1000, function (){ location.hash = target; }); }; $('html, body').hide(); $(document).ready( function(){ $('a[href^=#]').bind("click", jump); if (location.hash) { setTimeout(function () { $('html, body').scrollTop(0).show(); jump(); }, 0); } else { $('html, body').show(); } });
I've spend many days, trying to find workaround for this. Please, let me know how can i solve this :\ My website where this problem occurs is: http://reklama-ai.pl/wydruki-wielkoformatowe-reklama-zewnetrzna#tablice-tabliczki
Променено на