title: Using Vimeo's api after video called by ajax
body: <p>I'm using the <a href="http://demo.themezilla.com/garnish/" rel="nofollow">garnish</a> theme for a site and when the visitors clicks on an item in the folio, it loads the post's content. The post is made of one or more videos from vimeo, called via iframe like this:</p>
  
  <pre><code>&lt;iframe id="player_0" src="http://player.vimeo.com/video/57038297?title=0&amp;amp;byline=0&amp;amp;portrait=0&amp;amp;color=FF9A00&amp;amp;api=1&amp;amp;player_id=player_0" frameborder="0" width="632" height="356" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>I already have used vimeo's froogaloop to stop/unload videos from an external link (<a href="http://kevinchevallier.com/mandrake/test/playground.html" rel="nofollow">here's a very basic test</a>). Here's the code for the control:</p>
  
  <pre><code>var vimeoPlayers = document.querySelectorAll('iframe'), 
      player;
  
  for (var i = 0, length = vimeoPlayers.length; i &lt; length; i++) {
      player = vimeoPlayers[i];
      $f(player).addEvent('ready', ready);
  }
  
  function addEvent(element, eventName, callback) {
      if (element.addEventListener) { 
          element.addEventListener(eventName, callback, false); 
      }
      else { 
          element.attachEvent(eventName, callback, false); 
      }
  }
  
  function ready(player_id) {
      var container = document.getElementById(player_id),
          froogaloop = $f(player_id);
      $("a.stopvid").on('live', function(){ froogaloop.api('unload'); });
  }
  </code></pre>
  
  <p>But this time i can't seem to manage to use the api as the video loads after an ajax call. </p>
  
  <p>I've tryed to include the code above within an <code>$(document).ajaxComplete(function(event, xhr, settings) { ... });</code> but with no luck.</p>
  
  <p>Here's a <a href="http://kevinchevallier.com/mandrake/" rel="nofollow">test site</a> to see it. The <strong>portfolio</strong> link in the menu, then click the <strong>first item</strong>. It'll load the content and a little cross on the top right corner that should stop the video, but doesn't.</p>
  
  <p>Help would be highly appreciated, i'm pretty lost.</p>