Only first image is shown #1245

fibis opened this Issue Nov 27, 2016 · 1 comment


None yet

2 participants

fibis commented Nov 27, 2016 edited

We use photoswipe on a website and have one problem: when we open a gallery, the slider counts all images, but only the first image will be shown, but it is possible to cycle thru all of the images. After closing and reopening the gallery, all images are shown. This is our js code:

function menuClicked(id) {
            var pswpElement = document.querySelectorAll('.pswp')[0];
            var items = [];
            $.getJSON("ajax/images?restaurant=" + id, function (data) {
                for (var i = 0; i < data.length; i++) {
                    var img = new Image();
                    img.src = data[i].path;
                                src: data[i].path,
                                w: img.naturalWidth,
                                h: img.naturalHeight
                var options = {

                    history: false,
                    focus: false,
                    closeOnScroll: false,

                    showAnimationDuration: 0,
                    hideAnimationDuration: 0


                var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
fbio commented Nov 29, 2016

Got the same problem! Following this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment