Website Building » Squarespace » How Do I Jump to a Section in Squarespace?

How Do I Jump to a Section in Squarespace?

Last updated on December 12, 2022 @ 1:40 pm

Squarespace is an amazing platform that allows you to quickly and easily create a beautiful website. One of the best features of Squarespace is the ability to add a table of contents to your pages. This allows your visitors to quickly jump to the section of your page that they are interested in.

To add a table of contents to your Squarespace page, simply add the following code to the section of your page:

< script >
functionJumpToSection(section) {
document.getElementById(section).scrollIntoView();
}
< /script >

You can then add links to your table of contents using the following code:

PRO TIP: If you are not careful, you can easily jump to the wrong section on Squarespace. Be sure to double-check where you are before you make any changes.

< a href="#" onclick="JumpToSection('section1');" >Section 1< /a >
< a href="#" onclick="JumpToSection('section2');" >Section 2< /a >
< a href="#" onclick="JumpToSection('section3');" >Section 3< /a >

Replace “section1”, “section2”, and “section3” with the id’s of the sections you want to link to. You can find the id of a section by inspecting the element in your browser’s Developer Tools.

That’s all there is to it! Now when someone clicks on one of your table of contents links, they will be taken directly to that section on your page.

Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.