jcadima
9/2/2015 - 2:08 PM

Stop Youtube Video on closing Modal (BootStrap)

Stop Youtube Video on closing Modal (BootStrap)

	// Stop Youtube Modal videos when closed
	jQuery('.btn_close').click(function () {
	  jQuery('.bs-example-modal-lg').hide();
	  jQuery('.bs-example-modal-lg iframe').attr("src", jQuery(".bs-example-modal-lg iframe").attr("src"));
	});
REF:
https://teamtreehouse.com/community/bootstrap-video-modal-will-not-stop-playing


<div id="haiti_hazard_videos" class="modal fade bs-example-modal-lg" aria-labelledby="myLargeModalLabel">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title">BC Winegrowers Series</h4>
          </div>
          <div class="modal-body">
            <iframe width="550" height="350" src="http://www.youtube.com/embed/mwuPTI8AT7M?rel=0" frameborder="0"></iframe>
          </div>
        </div>
      </div>
    </div>  
...
....
    
            <div class="close_button">
            	<a data-dismiss="modal" href="#" class="btn_close"><i class="fa icon-caret-left"></i>&nbsp;BACK</a>
            </div>