Jump to content

[Share] How to make Video Block clickable

Recommended Posts

Posted

To make a Video Block clickable, you can use these options.

#A. Option 1: Add a clickable transparent image over Video

#1. You can add an Image Block with Transparent Image. 

If you can't design a transparent image, you can use any images (we will use code to make it transparent then).

image.png.abfcd1a7f70e9a623a3803b920ca3f49.png

#2. Next, add Link to Image

image.png.8029799ba20764d9e1adb77787925fca.png

#3. Drag Image over Video

image.png.2d1c93a8d26950347952ce25d99d1675.png

#4. Find Image Block ID.

In my example, it is: #block-yui_3_17_2_1_1732609379795_19276

image.png.7408c28e3aa453255cb1650aa5a3a439.png

#5. Use this code to Custom CSS box

#block-yui_3_17_2_1_1732609379795_19276 {
	opacity: 0;
}

image.png.a18960cab76e71423c029976caf75f87.png

#B. Option 2: Use JS code

Suppose you have 2 Video Blocks and you need to make both clickable.

image.png.63837cd4389200b8f5397651372e93f7.png

#1. First, find ID of 2 Videos

In my example, it is: #block-yui_3_17_2_1_1732609379795_18503 and #block-0047174352b5fa64d8c4

image.png.e7588d919417e500b465c655d7d9762a.png

#2. Add link to Video Caption

image.png.14b9d4b8c1c8d65ce44cd8a631cf16cc.png

image.png.a33aca8b3e08250849fba1addb7130f9.png

#3. Use this code to Custom CSS to hide Caption

#block-yui_3_17_2_1_1732609379795_18503, #block-0047174352b5fa64d8c4 {
  .video-caption {
    display: none;
  }
}

image.png.216c46859429f9bb4e72be70b4edfd96.png

#4. Use this code to Code Injection Footer to make both videos clickable

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $(".video-block").click(function(){
        window.location=$(this).find(".video-caption a").attr("href"); 
        return false;
    });
});
</script>

image.png.a1aca3ccf1d834cfd1726da28be4acf7.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • Replies 0
  • Views 141
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

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.