jquery - Overlay youtube embedded video with image, hide image when clicked and autoplay -


i display image before viewing youtube video in page. there way jquery or javascript function.

i want overlay own image , when clicked, display video , autoplay it, wihtout reloading page.

thank help

regards judi

if using html5 iframe youtube, above won't work video play in background autoplay=1 set before image clicked. instead used .append() append iframe after click on image video autoplay after click event image.

<body> <script type="text/javascript" src="jquery-1.4.2.min.js"></script>   <div id="ytapiplayer2" style="display:none;"> </div>  <img src="https://i.qmyimage.com/mgen/global/zgetimagenew.ms?args=%22shpimg4198.jpg%22,425,96,1" id="imageid" /> <script type="text/javascript"> $('#imageid').click(function() { $('#ytapiplayer2').show(); $('#ytapiplayer2').append('<iframe width="1130" height="636" src="http://www.youtube.com/embed/yourvideocodehere?autoplay=1" frameborder="0" allowfullscreen></iframe>'); $('#imageid').hide(); }); </script> </body> 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -