Jump to content

Make custom code block (video) into clickthrough

Recommended Posts

Hello

How do I make the custom code block - the block which is autoplaying a video from Vimeo - into a button that clicks through to a chosen URL?
https://www.simoneaves.com/testy

This is the code I have - in the block - so far...

<div id="clickable-div" style="position: relative; width: 500px; height: 280px; overflow: hidden; border-radius: 10px; cursor: pointer;">
  <iframe src="https://player.vimeo.com/video/726095855?badge=0&amp;autoplay=1&amp;autopause=0&amp;loop=1&amp;player_id=0&amp;app_id=58479&background=1&muted=1" style="width: 100%; height: 100%;" frameborder="0" allow="autoplay; picture-in-picture" title="GHOST CAR - SEX - GRADED FINAL - 422HQ" allowfullscreen controls="0"></iframe>
</div>

<script>
  document.getElementById('clickable-div').addEventListener('click', function() {
    window.open('https://www.google.com/search', '_blank');
  });
</script>


Cheers!

@tuanphan - I bet you know 🙂

Link to comment
  • Replies 0
  • Views 1k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.