Kimberlee Ho
Kimberlee Ho

Reputation: 487

Shadowbox not working after ajax load data

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);
                    }

                }
            }); 

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>";

Does running shadowbox javascript caused the error? How do i make the shadowbox work?

Upvotes: 2

Views: 1780

Answers (2)

azlan4ziz
azlan4ziz

Reputation: 21

use

Shadowbox.init({ skipSetup: true }); Shadowbox.setup(); 

instead of Shadowbox.init();

Upvotes: 2

Kimberlee Ho
Kimberlee Ho

Reputation: 487

Got it work already.

Solution From http://shadowbox.1309102.n2.nabble.com/Documents-loaded-through-ajax-shadowbox-not-working-td1309124.html

We can only call Shadowbox.init(); 1 time. Therefor error occurs when i called Shadowbox.init(); in ajax load.

Upvotes: 1

Related Questions