title: VideoJS: Stopping video on modal close and not embedding in page
body: <p>I have been using the JavaScript script VideoJS: <a href="http://videojs.com/" rel="noreferrer">http://videojs.com/</a> to build some video players that can be shown to the user in a popup. I have built the popup as follows:</p>
  
  <pre><code>        &lt;script type="text/javascript"&gt; 
  
              VideoJS.setupAllWhenReady();
  
              jQuery(document).ready(function ()
              {
                  // videos have video js applied to them
                  //$("video").VideoJS()
  
                  $(".show-video").click(function ()
                  {
                      $(".video-background").show();
                      $(".video-container").fadeIn("fast");
                  });
                  $(".close-video").click(function ()
                  {
                      $('.video-background').fadeOut();
                      $('.video-container').fadeOut();
  
                  });
              });
          &lt;/script&gt;
  
  &lt;a class="show-video"&gt;Show Video&lt;/a&gt;
  
          &lt;div class="video-background"&gt;
              &lt;div class="video-container"&gt;
  
                  &lt;div class="video-js-box vim-css"&gt;
                      &lt;video id="video1" class="video-js" poster="wallpaper.png" controls="controls" width="1024" height="768"&gt;
                          &lt;source src="video.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /&gt; 
                          &lt;object id="flash_fallback_1" class="vjs-flash-fallback" width="1024" height="768" type="application/x-shockwave-flash"
                              data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"&gt; 
                              &lt;param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" /&gt; 
                              &lt;param name="allowfullscreen" value="true" /&gt; 
                              &lt;param name="flashvars" value='config={"playlist":["poster.png", {"url": "video.mp4","autoPlay":false,"autoBuffering":true}]}' /&gt; 
                            &lt;/object&gt;
                      &lt;/video&gt;
                  &lt;/div&gt;
  
                  &lt;a class="close-video"&gt;Close Video&lt;/a&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>I have two problems:</p>
  
  <p>1) If the video is playing and the user closes the video popup, the video will still be playing in the background... how do I stop this?</p>
  
  <p>2) I've noticed on sites like: <a href="http://www.apple.com/imac/features.html" rel="noreferrer">http://www.apple.com/imac/features.html</a> that the videos popup in the same way by using a hashtag and id to show content but unlike in my example the video isn't in the page... any ideas on how they do this? As they arn't loading an external webpage. Would love to see some examples of how to do this with jQuery as I will be having multiple videos so would be great to just pull them in based on the hashtag on the link!</p>
  
  <p>Thanks</p>