Keresés

Új hozzászólás Aktív témák

  • randras

    veterán

    válasz martonx #5522 üzenetére

    var openPhotoSwipe = function(items, options) {
    var pswpElement = document.querySelectorAll('.pswp')[0];
    var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
    gallery.init();

    function gotoD() {
    gallery.goTo(gallery.items.length-1);
    gallery.invalidateCurrItems();
    gallery.updateSize(true);
    return false;
    }

    function add() {
    jQuery.ajax( {
    url: "ajax.php",
    method: "POST",
    data: { title: jQuery(".hidden-title").html(), parameter: jQuery(".sizes-select :selected").last().text(), method: "add" },
    dataType: "json"
    })
    .done(function(items) {
    gallery.close();
    document.location.replace("asd.php");
    })
    .fail(function() {
    alert("AJAX kommunikációs hiba történt!");
    });
    }

    gallery.listen('afterChange', function() {
    jQuery(".add").click(add);
    jQuery(".goto-D").click(gotoD);
    });

    gallery.listen('destroy', function() { document.location.replace("asd.php"); });

    gallery.listen('imageLoadComplete', function(index, item) {
    jQuery("img").removeClass("loading");

    jQuery(".add").click(add);
    jQuery(".goto-D").click(gotoD);
    });

    gallery.listen('close', function() {
    jQuery("img").removeClass("loading");
    });
    };

    A destroy listener gombra kattintva hozzáadva lenne tökéletes, viszont önmagában sem működik, csak 10-ből úgy 5-ször.

Új hozzászólás Aktív témák

Hirdetés