tootansimooon Posted January 16 Posted January 16 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&autoplay=1&autopause=0&loop=1&player_id=0&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 🙂
tuanphan Posted December 3 Posted December 3 Use this new code <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&autoplay=1&autopause=0&loop=1&player_id=0&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 src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function() { $("#clickable-div").click(function() { var link = $(this).text(), href = "https://www.google.com/search"; window.location.href=href; }); }); </script> 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!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment