Quantcast
Channel: Niluka Blog » Jquery
Viewing all articles
Browse latest Browse all 17

Twitter Bootstrap Modal stop Youtube video

$
0
0

Explain how you can get boostrap model video to stop playing because when close the model, still hear it in the background.

There is a nice proper way of doing this.
Could get the model iframe src attribute and make it empty.
Also when click the source where the model open, set relevant youtube video url back to src attribute.

Model close event


$('#youTubeModel').bind('hide', function () {
	$('#youTubeModel').find('iframe').attr('src', '');
});

Model open event


$('.youtube_vidoe').on('click', function(){
	$('#youTubeModel').each(function(){
		var src = $(this).find('iframe').data('scr');
		$(this).find('iframe').attr('src', src);
	});
});



Viewing all articles
Browse latest Browse all 17

Trending Articles