Getting a link to change the <a src=> of an iframe

Hi there!

I wanna have a big google maps frame, with a menu on the left which changes the pinned location based on which menu link you click. London takes you to London, Budapest to Budapest and so on…

This is the code I use for the iFrame:

(iframe
width=“100%”
height=“100%”
frameborder=“0” style=“border:0”
src=“https://www.google.com/maps/embed/v1/place?key=API_KEY
&q=Budapest” allowfullscreen>
(/iframe)

So it basically needs to be able to change the whole “src=www.url.com/etc”.
Is there any way I can make a link block do this? When I try to use “custom (a) code” it just says “This name is reserved”.

https://preview.webflow.com/preview/googlemapstest?preview=a106866e01c1c5e49d82f6eac03b37e7

I hope someone can help! :smile:
Best regards,
Stian

I don’t think you can do that with Custom ATTRIBUTES. Custom attributes are here to give attributes to elements, that you can use later with an engine like a JS API.

I think you’re going to need JS to dynamically change code.

And if it’s to change the url entirely, this will refresh the iframe, so why not using a tab widget in webflow to put all your iframes into tab contents? That way, you click a tab, it shows another map with another pin.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.