Jump to content

Using Maths in a Button URL to Dynamically Change Pages

Recommended Posts

Hey guys, I'm looking to add some code functionality to my buttons on pages, that will allow me to easily create Next/Previous buttons. My thinking is essentially, that say if the Next button is clicked, it takes the current page URL (which would be something like "sitename.com/page/3") and add one to the number on the end, taking you to "sitename.com/page/4", and of course, subtract for going to the Previous page (on the first page, there wouldn't be a Previous button, and on the final page, there wouldn't be a Next).

I used to program websites by hand with HTML, CSS, Java and PhP back in highschool, but that was quite a while ago for me so while I should be able to understand the basics of what I need to do, I don't know how to do it in Squarespace's environment.

Thanks for any help!

Link to comment
2 hours ago, PlanetAlexanderProjects said:

Hey guys, I'm looking to add some code functionality to my buttons on pages, that will allow me to easily create Next/Previous buttons. My thinking is essentially, that say if the Next button is clicked, it takes the current page URL (which would be something like "sitename.com/page/3") and add one to the number on the end, taking you to "sitename.com/page/4", and of course, subtract for going to the Previous page (on the first page, there wouldn't be a Previous button, and on the final page, there wouldn't be a Next).

I used to program websites by hand with HTML, CSS, Java and PhP back in highschool, but that was quite a while ago for me so while I should be able to understand the basics of what I need to do, I don't know how to do it in Squarespace's environment.

Thanks for any help!

You are in need of a pagination feature, how you gonna save your site content?

 

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates)

If you find my answer useful, 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...

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.