tags:

views:

39

answers:

0

I have an image gallery inside ListView which is inside UpdatePanel. To preview images i use slimbox2. Once i load page all works smoothly but after first post back (moving page with Ajax Async call) slimbox2 fails to load image and just redirect to it as it was normal link.

I did search on this website for solution and found this one.

Problem that it still doesn't work.

So the question is whether i did implement it correctly or is there any other workardound to make ASP:Ajax treat other js normally?

This is my implementation inside of slimbox2.js. I hook to plugin load and changed regular js call to one i've found in solution above. Of course i did commented initial call before trying it. Just kept it here for reference.

// AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) {


    jQuery(function ($) {
        $("a[rel^='lightbox']").slimbox({/* Put custom options here */
    }, null, function (el) {
        return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
    });
});


    jQuery(function ($) {
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $("a[rel^='lightbox']").slimbox({}, null, function (el) {
                return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
            });
        };
    });

}