jackwanders/GalleryView

Single Image bug

S-ed opened this issue · 1 comments

S-ed commented

Greetings.
There some bug with navigation/display appears when only one image loaded.
(Image disappears/becomes semitransparent etc)

  • It'll be great if script will count images and hide navigation if only one image in gallery.

This one is a pretty easy fix -- I just modified the showNext and showPrev methods to do nothing if there is only one image:

        showNext: function() {
+           // Next/Previous don't need to do anything if there is only one image
+           if (this.numImages == 1) {
+               return;
+           }
            this.navAction = 'next';
            this.showItem(this.frameIterator+1);
        },

        showPrev: function() {
+           // Next/Previous don't need to do anything if there is only one image
+           if (this.numImages == 1) {
+               return;
+           }
            this.navAction = 'prev';
            this.showItem(this.frameIterator-1);