How to stop a Vimeo or Video by close with Jquery

vimeo.png

In some of the cases when we close the button of a modal or popup in which our Video or Vimeo is playing. after closing the Vimeo or video still playing. Do not worry. we can close this simply by Jquery. First, you need to add an id to the iframe.
jQuery('.close_button').click(function() {
var $iframe_id = $('iframe#iframe_id');

// below code is for saving the current iframe source(src)
var videosrc = $iframe_id.attr('src');

// below code clears the source(src) or stopping the video/vimeo
$iframe_id.attr('src',''); 

// below code gets it back to the right link so that when again opening the vdeo will work similarly
$iframe_id.attr('src', videosrc);
});
That's it...!!!