html - Change iframe parent while playing embedded youtube video -
i want change parent of iframe used embedding youtube video.
when change parent:
- firefox , chrome: player stops playing , displays new (stopped) player in new parent.
- ie: player continues playing , displays new (stopped) player in second div. user sees stopped player hears video.
here sample fiddle: http://jsfiddle.net/mehmetatas/znuuf/1/
try { var div1 = $('#div1') var video = div1.find('.video')[0]; var div2 = $('<div id="div2"></div>'); $(video).appendto(div2); div2.appendto($('.parent')); div1.remove(); } catch (e) { alert(e.message); }
it seems iframe content getting refreshed when parent changes.
is possible video continues playing in new parent?
if not, firefox , chrome's behavior ok, how can fix ie's behavior?
what can think of use classes
instead of ids
in html/css this:
<input id="btn" type="button" value="move"></input> <div class="parent"> <div class="div1"> <div class="video"> <iframe width="300" height="200" src="http://www.youtube.com/embed/98lhno0ximy" frameborder="0" allowfullscreen></iframe> </div> </div> </div>
and
.div1 { position: absolute; top: 50px; width: 300px; height: 200px; border: solid 3px green; } .div2 { position: absolute; top: 50px; left: 325px; width: 300px; height: 200px; border: solid 3px red; }
this way in js script
need state:
var div1 = $('.div1') div1.removeclass('div1') div1.addclass('div2')
this way div positioned new div2 class says , move without stopping or refreshing.
hope looking for.
Comments
Post a Comment