开发者

How to addClass to a body tag inside a generated iframe

I'm using JQ Colorbox plug-in (a sort of Lightbox) and I'd like to add a class to the body of a document loaded via Colorbox's iframe function.

Basically, I was trying to:

$("iframe").contents().find('body').addClass('foo');

but that doesn't seem to work, probably because my iframes are not generated until after a user invoke C开发者_运维问答olorbox?

Is there a way to achieve such result?

Many thanks.


The ColorBox documentation says that there are 4 event hooks you can use. For example (lifted from their examples page);

$("#myColorBox").colorbox({
    onComplete: function(){
        alert('onComplete: colorbox has displayed the loaded content');
    }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜