saj_3472 Posted July 2, 2021 Posted July 2, 2021 Site URL: https://www.smoredate.com/ Once the web page loads, I want to automatically jump to a section on the home page without using anchor links or having to press a button/click a link. I created a redirect using div as below: <div id="scroll-here"> </div> It takes you to the Home page on the navigation bar with the anchor tag in the url slug--> /home#scroll-here Then I set up a script in the landing page where I want the auto scroll to work: <script>var url= "https://www.smoredate.com/home#scroll-here"; window.location = url; </script> The code works on the front end but Squarespace dashboard never stops loading, I'm assuming it's jumping between the two home pages: the one on the navigation bar and the landing home page! Where did I go wrong?! :( Beyondspace 1
Solution Beyondspace Posted July 2, 2021 Solution Posted July 2, 2021 2 hours ago, saj_3472 said: Site URL: https://www.smoredate.com/ Once the web page loads, I want to automatically jump to a section on the home page without using anchor links or having to press a button/click a link. I created a redirect using div as below: <div id="scroll-here"> </div> It takes you to the Home page on the navigation bar with the anchor tag in the url slug--> /home#scroll-here Then I set up a script in the landing page where I want the auto scroll to work: <script>var url= "https://www.smoredate.com/home#scroll-here"; window.location = url; </script> The code works on the front end but Squarespace dashboard never stops loading, I'm assuming it's jumping between the two home pages: the one on the navigation bar and the landing home page! Where did I go wrong?! 😞 Try settings hash url only location.hash = "#scroll-here" saj_3472 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - PDF Lightbox popup - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> No-code customisations for Squarespace
saj_3472 Posted July 2, 2021 Author Posted July 2, 2021 7 hours ago, bangank36 said: Try settings hash url only location.hash = "#scroll-here" This works! Thank you! Beyondspace 1
JesseBiltz Posted January 4 Posted January 4 Could someone walk me through this, please? I can't tell what you're suggesting to do instead. Talk to me like I'm 5. I put the anchor in the section, right? Then where do I put the other code and how should it look. I tried a few things with my limited understanding. Thanks.
tuanphan Posted January 8 Posted January 8 On 1/5/2024 at 4:16 AM, JesseBiltz said: Could someone walk me through this, please? I can't tell what you're suggesting to do instead. Talk to me like I'm 5. I put the anchor in the section, right? Then where do I put the other code and how should it look. I tried a few things with my limited understanding. Thanks. With script code, you can add it to Website Tools (under Not Linked navigation) > Code Injection > Scroll down to Footer box Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment