title: jQuery toggle class when iframe src changes
body: <p>I'm using a SoundCloud.com music player plugin called Stratus.  The plugin allows you to set the class "stratus" on any anchor pointing to a soundcloud track and when clicked, will dynamically add the track to the player and begin playing. jsfiddle example: <a href="http://jsfiddle.net/2CCS6/" rel="nofollow">http://jsfiddle.net/2CCS6/</a></p>
  
  <p>In addition to the toggle I have below, I'd like to toggle or remove "pause" from (this) when the src of the iframe changes.  I've styled all .stratus links as play buttons and the issue is that when they're clicked, they (visually) remain in a play state. By toggling the class pause, I can display a pause icon instead to indicate the active track and pause functionality.</p>
  
  <p>The version I have here sort of works for the click function but it seems to interfere with the function below it.  As for toggling when the iframe src changes... I was looking into this.contentWindow.location but not sure if that will work due to the domain mismatch.</p>
  
  <pre><code>$('a.stratus').click(function() {
    $(this).toggleClass('pause');
    $.postMessage($(this).attr('href'), src, $('#stratus iframe')[0].contentWindow);
    return false;
  });
  return $.receiveMessage(function(e) {
    return $('#stratus').toggleClass('open');
  }, root_url);
  </code></pre>
  
  <p>Thanks for any help you can offer!</p>