我的 jQuery 代码
$("#div1").load("test1.html")
$("a#link").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'width' : 400,
'height' : 200,
'overlayOpacity': 0.5,
'type' : 'iframe'
});
.load
之后我的 fancybox 无法工作。
它在 test1.html
中工作。
我该怎么写?
最佳答案
我对 fancybox 一无所知,但是当使用 load 函数时,数据是异步加载的,因此调用 load 之后的任何操作都可以在加载之前完成。如果您希望它影响您已加载的项目,您应该将代码添加到回调中。
$("#div1").load("test1.html", function () {
$("a#link").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'width' : 400,
'height' : 200,
'overlayOpacity': 0.5,
'type' : 'iframe'
});
})
关于javascript - fancybox 的回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10809982/