Note that there are some explanatory texts on larger screens.

plurals
  1. POChange youtube video on image on stop state
    text
    copied!<p>I made the code like this which changes an image on the web-site on Youtube video.</p> <pre><code>&lt;script type="text/javascript"&gt; $(window).load(function(){ $('img.demovideo').click(function(){ video = '&lt;iframe class="demovideo" width="100%" height="551px" src="'+ $(this).attr('data-video') +'"&gt;&lt;/iframe&gt;'; $(this).replaceWith(video); }); $('img.demovideo').css('cursor', 'pointer'); }); &lt;/script&gt; </code></pre> <p>How can I change the Youtube video back on image on player state 0?</p> <p>I made a code like this, but it doesn't work:</p> <pre><code>&lt;script type="text/javascript"&gt; raketaplayer.onStateChange () { b = raketaplayer.getPlayerState(); if (b=0) { image = '&lt;img class="demovideo" src="http://raketa.pro/wp-content/uploads/2013/03/image_header_2.png" data-video="http://www.youtube.com/embed/7hoqO36CVRM?&amp;amp;rel=0&amp;amp;theme=light&amp;amp;showinfo=0&amp;amp;hd=1&amp;amp;autohide=1&amp;amp;color=white&amp;amp;autoplay=1&amp;amp;enablejsapi=1&amp;amp;playerapiid=raketaplayer" style="cursor: pointer;"&gt;'; $(iframe.demovideo).replaceWith(image); }); $('img.demovideo').css('cursor', 'pointer'); }); } } &lt;/script&gt; </code></pre> <p>What's wrong with it? Please, help :)</p> <p>Image code as follows:</p> <pre><code>&lt;img class="demovideo" src="http://raketa.pro/wp-content/uploads/2013/03/image_header.png" data-video="http://www.youtube.com/embed/7hoqO36CVRM?&amp;rel=0&amp;theme=light&amp;showinfo=0&amp;hd=1&amp;autohide=1&amp;color=white&amp;autoplay=1&amp;amp;enablejsapi=1&amp;amp;playerapiid=raketaplayer"&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload