Jump to content

Change iframe url with clickable links

Go to solution Solved by vixxr,

Recommended Posts

Hi all,

First post, i think, probably have posted under a different name a few years ago.

Probably not the last post either. Thanks to all the people here that are so helpful as ive been searching around in the past weeks.

Ive just discovered iframes after upgrading to business, 

put simple-

gallery page - lots of images so slow load and long scroll,

to break it up, I'm going to have a few separate gallery pages,

i want them displayed on the portfolio page it belongs to,

so with an iframe displaying the first page:

how do i hyperlink the words at the top Gallery 1 Gallery 2 etc

to change the content of the iframe ?

current code block contains 

<iframe src="https://www.website.net/start1" width="100%" height="900"></iframe>

*******

pword if needed : *******

thanks, I'm a bit burnt out googling stuff so thought to try to good people here.

 

Edited by vixxr
changed links
Link to comment

You may want to use this type of setup: 

though use of iframes is generally not an efficient setup for galleries, and when you've got 4 they will take some time to load.

 

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 

  Did I help? Buy me a coffee?

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

Link to comment

thanks, tabs would be cool, good to know they are possible. 

I haven't even begun to consider jscript possibilities for anything, cool stuff.

And like you said, more loading, especially for mobile.

Unless they only load when clicked on.

Still hoping for a way to do it by changing the single i frame content,

come to think, its how basic html sites used to work anyway, i must be 

missing something obvious.

Link to comment

ahh I think i know what to do, just not sure how yet. 

just have the navigation to the other 3 pages inside the page displayed in the iframe ?

so like a floating button or custom fixed header for just those pages.

then when clicked it loads the other page. tried, it works to load one page at a  time, now just need the button or custom header.

Link to comment
  • Solution

got it working, from browsing here and google

for anyone else looking here is solution i used, can feel my way forward from this base and tinker for different results.

code block at bottom

//removed header and footer so they not in iframe
<style>
  .header, #footer-sections{
    display:none !important;
  }
</style>

//button that stays on screen while scrolling iframe content, link to next content to load in same frame

<a href="https://www.website.com/gallery2" class="t-button">Gallery 2</a>
<style>
  .t-button {
      display: inline-block;
    background: red;
    color: white;
    padding: 1em 2em;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    position: fixed;
    top: 5%;
    left: 1;
    
  }
</style>

thanks to ziggy where i saw idea for floating button, and tuanphan here

https://forum.squarespace.com/topic/162281-floating-button-navigation/

cool.

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.