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

Auto scroll to a section on the page after first landing


saj_3472

Question

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?! :(

Link to comment

2 answers to this question

Recommended Posts

  • 0
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"

Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Youtube Gallery for Squarespace
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Create an account or sign in to comment

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

×
×
  • Create New...