Notice: Undefined variable: string in /home/u665484253/domains/wpcodekit.com/public_html/wp-content/themes/twentytwenty-child/functions.php on line 61
How to stop and pause youtue video in jquery?
Html
<iframe width="560" height="315" src="https://www.youtube.com/embed/mKt-MDwtVB4" frameborder="0" allowfullscreen></iframe> <button class="fancybox-close">Stop video please</button>
CSS
body {width:60%;margin:3em auto;} footer {border-top:1px solid #ccc;padding:1em 0;}
jQuery
// Finds all iframes from youtubes and gives them a unique class jQuery('iframe[src*="https://www.youtube.com/embed/"]').addClass("youtube-iframe"); jQuery(".fancybox-close").click(function() { // changes the iframe src to prevent playback or stop the video playback in our case $('.youtube-iframe').each(function(index) { $(this).attr('src', $(this).attr('src')); return false; }); //click function });
Read More Posts
- How to detect the current user has an active subscription in woocommerce?
- How to create vertical hamburger menu in wordpress?(Collabse Menu)
- How to get last id from sql database in wordpress ?
- How to use jquery on checkbox in worpdress ?
- How to fetch data (messages) in every second with ajax (setinterval) from mysql (PHP) in wordpress?