Търсене в помощните статии

Избягвайте измамите при поддръжката. Никога няма да ви помолим да се обадите или изпратите SMS на телефонен номер или да споделите лична информация. Моля, докладвайте подозрителна активност на "Докладване за злоупотреба".

Learn More

Firefox jumps after scrollTo(value) and after animate({scrollTo:value})

  • Няма отговори
  • 1 има този проблем
  • 2 изгледи
more options

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

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: <pre><nowiki>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(); } });</nowiki></pre> 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

Променено на от cor-el