google-code-export / galleriffic

Automatically exported from code.google.com/p/galleriffic
0 stars 0 forks source link

HELP - Get "galleriffic" object instance from another galleriffic object #285

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi all,
I need some help regarding the Galleriffic plugin. I have a html page that 
contains multiple thumbs (one thumb per gallery) and only one thumb is 
displayed.
 My question is: how can I get an instance of one thumb/gallery from another thumb?
 For example, I have something like this in my html file:
-----var gallery = $('#thumbs'+i).galleriffic({..})-----
 When I press "previous link" and the currentPage is 0, I want to be able to show the previous gallery and to the last page of the gallery.

On my "previousPage: function(dontPause, bypassHistory)" function I have 
something like this, but I dont` know how to get the #thumb(i-1) object:

//var startIndex = (this.getNumPages()-1) * this.numThumbs;
                    //var prevPage = startIndex + this.numThumbs;               
                    //this.gotoIndex(prevPage, dontPause, bypassHistory);
                    var nextThumbId = 0;
                    if (this.currentIDD == 0) {
                        nextThumbId = this.thumbsNo-1;
                    } else {
                        nextThumbId = this.currentIDD-1;
                    }
                    //
                    thumbsNo = this.thumbsNo;               
                    //
                    $(this).hide();
//this gallery MUST BE THE PREVIOUS< NOT THE CURRENT
                    gallery.show();
                    var startIndex = (gallery.getNumPages()-1) * gallery.numThumbs;
                    var prevPage = startIndex + this.numThumbs;             
                    gallery.gotoIndex(prevPage, dontPause, bypassHistory);  

                    //$('#thumbs'+nextThumbId).show();

Original issue reported on code.google.com by calin.cr...@gmail.com on 17 Apr 2012 at 1:53

GoogleCodeExporter commented 9 years ago
I made a progress and I modified the previousPage function like this:

            previousPage: function(dontPause, bypassHistory) {
                var page = this.getCurrentPage();
                if (page > 0) {
                    var startIndex = page * this.numThumbs;
                    var prevPage = startIndex - this.numThumbs;             
                    this.gotoIndex(prevPage, dontPause, bypassHistory);
                }

                if (page == 0) {
                    $(this).hide();

                    var ngts = gallery.prevGal;
                    ngts.show();

                    var startIndex = (ngts.getNumPages()-1) * this.numThumbs;
                    var prevPage = startIndex + this.numThumbs;                     
                    ngts.gotoIndex(prevPage, dontPause, bypassHistory); 
                    //$('#thumbs'+nextThumbId).show();
                }

                return this;
            }

The problem is that the thumb is rendered fine but the first page of the thumb 
is displayed and then after a short period of time (some miliseconds) jumps to 
the last page. 
Any idea is welcome

P.S. Guys, I`m a JQuery newbie :)

Original comment by calin.cr...@gmail.com on 17 Apr 2012 at 6:49