chichi Posted June 13, 2020 Share Posted June 13, 2020 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" www.personalchefberlin.de password: june Link to comment
jpeter Posted June 14, 2020 Share Posted June 14, 2020 @chichi Add the following javascript code below. Features: 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 JavaScript (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 { init(); } // 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); document.body.appendChild(s); } else { smoothScrollInit(); } function smoothScrollInit(){ var scroll = new SmoothScroll('a[href*="#"]', { speed: SPEED || 300 }); } } })(window, document); Be sure to place the script between <script> tags, example: <script> // Add JS code here </script> See article on how to add javascript: https://support.squarespace.com/hc/en-us/articles/205815928-Adding-custom-HTML-CSS-and-JavaScript Link to comment
chichi Posted June 14, 2020 Author Share Posted June 14, 2020 @jpeter Thank you for the code. Where do I put this code? Custom CSS or code injection? Link to comment
jpeter Posted June 14, 2020 Share Posted June 14, 2020 @chichi I would use code injection and place it in the footer, see article https://support.squarespace.com/hc/en-us/articles/205815908 Link to comment
chichi Posted June 14, 2020 Author Share Posted June 14, 2020 @jpeter It worked thank you! Link to comment
Kate Posted June 30, 2020 Share Posted June 30, 2020 If you are looking for a way to add Anchor Links, Gallery Blocks, or a Rotating Banner with Content Blocks overlaid in Squarespace 7.1, you can find all these plugins in our Squarespace add-on store here: www.Squareaddons.com -- Enjoy! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.