开发者

jQuery removeClass problem

I have a little bit of problem here: I have the following js functions:

function setRounded(divId){
    $(divId).addClass("rounded-corners");
}
function unsetRounded(div开发者_高级运维Id){
    $(divId).removeClass("rounded-corners");
}

This two functions are called before and after an event: for example I have the following page:Testing page and i want to remove the rounded corners when i flip the block but it doesn't happen. Is there any refresh method ? I goggled a little bit but nothing similar.

Regards, Sorin!


Your code is almost correct, in fact the class is removed from the div. However the flip plugin seems to create a copy of the div to create the flipping effect, and that copy of the div still has the class.

You could try to remove the class before calling .flip on it, instead of using onBefore.


It behaves very inconsistently in Firefox 6.0. Have you tried changing:

$("#aboutMe").click(function(){
    $("#aboutMe").flip({
         onBefore:function(){
             unsetRounded("#aboutMe"); 
             return;
         },
         ...
    });
 });

to:

$("#aboutMe").click(function(){
    unsetRounded("#aboutMe");
    $("#aboutMe").flip({
        ...
    });
 });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜