在ajax加载数据后,Shadowbox无法正常工作 [英] Shadowbox not working after ajax load data

查看:103
本文介绍了在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();

这篇关于在ajax加载数据后,Shadowbox无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆