LINK Anchor for Section Does Not Work in FireFox

4
$(window).load(function() {
  $('a.scroll').each(function() {
    var id = $(this).attr('href');
    if (id.match('^#')) {

      var target = $(id).offset().top - 65;
      var title = $(this).attr('title');

      $(this).on('click tap', function() {
        $('body').animate({
          scrollTop: target
        }, 1000);
        history.pushState({
          foo: title
        }, title, id);
        return false;
      });
    }
  });
});

Same Page

<a href="pecas-servicos#qualidade" class="scroll" title="{!! trans('master.menu.qualidade')">Qualidade</a>

Another Page

<a href="pecas-servicos/contato#qualidade" class="scroll" title="{!! trans('master.menu.qualidade')">Qualidade</a>

When I'm on the HOME page and click on the LINK, the scrolling works until the section I clicked.

But if I'm on another page, it does not. It even goes to HOME, however, it goes down to the bottom of the page.

    
asked by anonymous 14.09.2015 / 16:37

1 answer

1

It does not recognize the post via Strange Script does not work only in Firefox. Two things I would try.

  • Placing the Full URL follows a test that I placed on my site ( link );
  • Force the URL by taking the parameter and finding the correct part of the page like this ( link ) ;
  • Talk later if any of them worked.

        
    16.09.2015 / 03:09