Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search

How to smooth scroll in Squarespace 7.1


melvinr

Recommended Posts

Hi im trying to add an anchor link into my website and want it to smooth scroll to it. Unfortunately I cannot find a way to make it work with safari, it works with chrome

 

I have enabled smooth scroll in Design > Custom CSS

 

Link to post
  • 2 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Did you ever find a solution? I found the following. It works to smooth scroll in Safari and Chrome, but the problem is that it has bugs when on mobile. When you are vertical and you click a link in t

Did you ever find a solution? I found the following. It works to smooth scroll in Safari and Chrome, but the problem is that it has bugs when on mobile. When you are vertical and you click a link in the dropdown hamburger menu, the menu gets stuck at the top of the site and the website seems to be frozen. 

SMOOTH SCOLL (works in both Chrome and Safari but gives bugs to safari mobile)

 

CSS injection

html {

scroll-behavior: smooth;

}

 

Header Injection 

<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>

 

Footer Injection

<!-- smooth scrolling -->

     <script type="text/javascript">

      $(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;

            }

          }

        });

      });

    </script>

Edited by misterdega
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...