title: Streamline this script
body: <p>I have some code that works but I just need to know whether I can reduce this down/streamline the script a bit better. The script works in conjuction with JQUERY's reveal script and stops Vimeo video playing when the reveal window is closed. I got the original script from StckOverlow but this was based on one video - I have 11.</p>
  
  <p>My script is as follows and as you'll see there seems to be alot of repetition. Is there any way to streamline this:</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
           jQuery(document).ready(function($) {
             $('body').live('click',function(){
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-1 iframe').attr('src');
                  $('#myModal-1 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-2 iframe').attr('src');
                  $('#myModal-2 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-3 iframe').attr('src');
                  $('#myModal-3 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-4 iframe').attr('src');
                  $('#myModal-4 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-5 iframe').attr('src');
                  $('#myModal-5 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-6 iframe').attr('src');
                  $('#myModal-6 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-7 iframe').attr('src');
                  $('#myModal-7 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-8 iframe').attr('src');
                  $('#myModal-8 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-9 iframe').attr('src');
                  $('#myModal-9 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-10 iframe').attr('src');
                  $('#myModal-10 iframe').attr('src','').attr('src',resourceVideo);
                  };
              if($('div.reveal-modal-bg').is(':visible')){
                  var resourceVideo = $('#myModal-11 iframe').attr('src');
                  $('#myModal-11 iframe').attr('src','').attr('src',resourceVideo);
                  };                                      
              })
          });
          &lt;/script&gt;
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>Many thanks</p>