Jump to content

Anchor link not scrolling

Recommended Posts

Hi I added an anchor link the main landing page. The link goes to the right place but instead of scrolling down it looks like it's jumping to another page. How can I do "scroll down" effect?

It's the main page button "Get started"


password: june


Link to comment
  • Replies 5
  • Views 1.3k
  • Created
  • Last Reply

@chichi Add the following javascript code below.


  • Targets all anchor links on the page
  • Update the SPEED variable in the javascript code if you want to adjust the speed of the scroll. The value needs to be a number in milliseconds. The default is set to 300 milliseconds


(function (window, document) {

  // Speed in milliseconds.
  var SPEED = 300;

   * DO NOT MODIFY CODE BELOW, unless you know what you're doing

  // Execute code based loading of the page
  if (document.readyState == 'loading') {
    document.addEventListener('DOMContentLoaded', init);
  } else {

  // Check if smooth scrolling library has been loaded. If so, then
  // enable all anchor links to scroll smoothly.
  function init() {
    // Create script to load smooth scroll libary if it's not already loaded:
    // https://github.com/cferdinandi/smooth-scroll
    if (!window.SmoothScroll) {
      var s = document.createElement('script');
      s.src = 'https://cdnjs.cloudflare.com/ajax/libs/smooth-scroll/16.1.3/smooth-scroll.min.js';
      s.addEventListener('load', smoothScrollInit);
    }  else {

    function smoothScrollInit(){
      var scroll = new SmoothScroll('a[href*="#"]', {
        speed: SPEED || 300
})(window, document);

Be sure to place the script between <script> tags, example:

  // Add JS code here

See article on how to add javascript: https://support.squarespace.com/hc/en-us/articles/205815928-Adding-custom-HTML-CSS-and-JavaScript

Full stack developer who loves helping people out with anything web related. If you'd like to support me, buy me a coffee!

Link to comment
  • 3 weeks later...


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.