Jump to content

Pacific Template - Anchor Scroll not working on iPad

Recommended Posts

Hello!I'm creating a website using the Pacific Template. All anchor links from the main navigation work perfectly on desktop, but on tablets they don't scroll but just jump to the correspondent section.

I solved the problem on phones where I use the hamburger menu with the following code (by @Manmeet ) , but on Ipad, where I still use the main navigation menu nothing happens.


$(function() {
      $('a[href*="#"]:not([href="#"])').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
          var target = $(this.hash);
          target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
          if (target.length) {
            $('html, body').animate({
              scrollTop: target.offset().top
            }, 1000);
            return false;
          }
        }
      });
    });

Does anybody knows how to solve the problem?Thank you!

Link to comment
  • Replies 0
  • Views 470
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.