jQuery removeClass re-renders video player in Firefox
I have this most annoying issue with removeClass
in Firefox.
I am using it to change some of the elements on the page so that when I resize my player the layout looks good. I am using JW player API to resize the player using the jQuery click method, then it starts playing automatically or from the position it was at.
Now all of that works perfectly in IE (surprising), Chrome, Opera, Safari. It's seemless with no hiccup. But Firefox will reinitialize the player and it starts over. I have a removeClass
that I perform on a div that surrounds the player. If I take that out, Firefox does what it's supposed to do. I have to use the removeClass
to realign my layout. It works fine with addClass
, just not with removeClass
.
Any ideas why it won't work with removeClass()
properly?
Below is my code how I want it to work and it does for EVERY browser but FF.
jQuery(document).ready(function(){
jQuery("#expand").live("click",function(event){
var time = jwplayer().getPosition();
var cont = $('#lcontents').html();
$('#tleft').html(cont);
$('#pleft').addClass("centerText videoWide");
$('#pleft').removeClass("column-video-left");
$('#lcontents').html("");
$('#tleft').addClass("column-video-left");
jwplayer().resize("854","480");
if(time > 0){
jwplayer().onReady(function() {
开发者_如何学Python jwplayer().seek(time);
});
}else if(time < 1){
jwplayer().play();
};
event.preventDefault();
});
});
Edit- The code below is the html
<div id="pleft" class="column-video-left">
<div id="rsplayer" class="video">jwplayer code renders here</div>
<div id="expand" style="text-align:center"><a href="#">Expand Player</a></div>
<div id="lcontents">
regular html code here.... which gets moved to div tleft
</div>
</div>
<div id="expand1"></div>
<div id="tleft"></div>
Have you tried manually modify the class attribute and seeing if that works?
It's possible this is a known bug in Firefox 3.6. You could try it in the Firefox 4 release candidate and see if you still have the same problem. If you don't, then someone who's good at doing Bugzilla searches could figure out what the bug was, and whether the fix will be backported to the 3.6 branch.
精彩评论