Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript ScrollTo not working in Firefox?

  • This topic is empty.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #163589
    nickjames
    Participant

    ScrollTo jquery is not working in firefox but working in both chrome and opera. Any ideas or hack to make it work smoothly in firefox? Something like this:

    function goToByScroll(id){
    $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
    

    }

    In firefox, this code does not produce any scrooll to top or bottom effect but stays as it is inactive. I need a way or hack to make it work and it’s a bit urgent. Thanks.

    #163591
    Paulie_D
    Member

    Do you have a link?

    #163592
    nickjames
    Participant

    hi Paulie, no, I don’t have a link for demo. But scrollTo in jquery is now working. This is a common problem you can see in forums and stackoverflow. What I want is any nice hack or way to get it working?

    #163594
    Paulie_D
    Member

    This is a common problem you can see in forums and stackoverflow.

    What do the other sites suggest?

    http://stackoverflow.com/questions/13054194/query-scrollto-does-not-work-in-firefox

    #163595
    nickjames
    Participant

    I put sample code that does not work in Firefox:

    <div style="margin: 100px 100px 1000px 100px">
            <div id="test" style="width: 100px; height: 100px; border: 3px solid black;">target object</div>
        </div>
    
    
    function scrolear(destino){
        var stop = $(destino).offset().top;
        var delay = 1000;
        $('body,html').animate({scrollTop: stop}, delay);
        return false;
    }
    
    scrolear('#test');
    
    #163596
    nickjames
    Participant

    Paulie, others suggest in stactoverflow sites to put the code as follows:

    $('body,html').animate( ... );
    

    But it does not work for me.

    #163598
    Paulie_D
    Member

    Then I’m afraid I do not have a solution…perhaps it’s a JQuery/Firefox bug?

    Anyone?

    #163599
    Paulie_D
    Member
    #163617
    nickjames
    Participant

    It’s okay Paulie. Leave it. Hope it will be resolved in upcoming versions of Mozilla firefox. Thanks for your support. But others reading this thread could help notify and disscuss the problem with Github-Firefox.

    #163633
    Senff
    Participant

    Out of the box, scrollto works fine in Firefox (mine at least): http://codepen.io/senff/full/ILgxw

    #163634
    Paulie_D
    Member

    Out of the box, scrollto works fine in Firefox

    Ditto

    #194548
    digitalmark
    Participant

    To make it work in FF, I replaced this:

    $(“#toTop”).click(function(){
    event.preventDefault();
    $(“html, body”).animate({scrollTop:0},”slow”);
    });

    with this:

    $(“#toTop”).on(‘click’,function(){
    $(“html, body”).animate({scrollTop:0},”slow”);
    return false;
    });

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘ScrollTo not working in Firefox?’ is closed to new replies.