tuanphan Posted November 27 Posted November 27 If you have a section with background video and a button like this. You want: If users click Pause Video button >> Pause section background video. If it doesn't work, you can send link to page where you use Video, I will check again. #1. Find ID of Button & ID of Video Section. In my example, we will have: Button ID: #block-yui_3_17_2_1_1732588943338_11548 Section ID: section[data-section-id="674535b561275a62ba933fcf"] #2. Use this code to Code Injection - Footer (or Page Header Injection) <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function() { $('#block-yui_3_17_2_1_1732588943338_11548').click(function() { const video = $('section[data-section-id="674535b561275a62ba933fcf"] video')[0]; if (video.paused) { video.play(); } else { video.pause(); } }); }); </script> #3. Note: Make sure you disable "Open in New Tab" option in Button #4. Remember to replace ID in the code 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