在ajax加载数据后,Shadowbox无法正常工作
问题描述:
在ajax加载数据后,Shadowbox无法工作。
我试图把Shadowbox.init()放到ajax加载函数中,也放在php页面中。什么都行不通。在ajax加载数据之前,Shadowbox正常工作。
Shadowbox is unable to work after ajax load data. I tried to put in Shadowbox.init() to ajax load function and also in the php page. Nothing works. Shadowbox is working fine before ajax loaded data.
$.ajax({
type:"post",
url: url1,
data: {offset:offset},
dataType: "html",
timeout: 10000,
success:function(data) {
Shadowbox.init();
if(data == 0){
$("#nodeal").show();
$(".more_deals").hide();
$("#nomore").val(1);
$('#loadimage').hide();
}else {
Shadowbox.init();
$("#nodeal").hide();
$(".more_deals").hide();
$('.loadmoredeals').append(data);
$('#loadimage').hide();
}
},
error:function(request, status, err) {
if(status == "timeout") {
gotoagain(offset);
}
}
});
html的PHP页面结果:( firefox可以使用此代码,chrome和IE无法使用此代码代码)
PHP page for html Result: (firefox can work with this code , chrome and IE not working with this code)
$html = "<script src='/static/js/shadowbox-3.0.3/shadowbox.js'></script>
<script>
Shadowbox.init();
</script>";
运行shadowbox javascript会导致错误吗?如何使影子箱工作?
Does running shadowbox javascript caused the error? How do i make the shadowbox work?
答
使用
Shadowbox.init({ skipSetup: true }); Shadowbox.setup();
而不是
Shadowbox.init();
instead of Shadowbox.init();