X-Git-Url: https://svn.cri.ensmp.fr/git/Portfolio.git/blobdiff_plain/3940d117b095679f682c973f0bdc83e877b214e6..8d2c6b1d7f684c3bf529091a4344fe2a5f68b15d:/skins/photo_lightbox_viewer.js?ds=sidebyside diff --git a/skins/photo_lightbox_viewer.js b/skins/photo_lightbox_viewer.js index d659ac1..017dbc0 100644 --- a/skins/photo_lightbox_viewer.js +++ b/skins/photo_lightbox_viewer.js @@ -14,10 +14,9 @@ var reSelected = /.*selected.*/; Lightbox = function(grid, toolbar, complete) { var self = this; this.grid = grid; - this.lastSlide = this.grid.children[this.grid.children.length-1]; + this._buildSlidesIndex(); // set this.slides and this.lastSlide; this.fetchingDisabled = false; this.complete = complete; - console.log('complete:', complete) this.toolbar = toolbar; if (toolbar) { this.toolbarFixed = false; @@ -47,13 +46,25 @@ Lightbox = function(grid, toolbar, complete) { } }; +Lightbox.prototype._buildSlidesIndex = function() { + this.slides = []; + var node, i; + for (i=0 ; i this.lastSlide.firstElementChild.offsetTop - getWindowHeight()) { + getWindowScrollY() > + (this.lastSlide.firstElementChild || this.lastSlide.children[0]).offsetTop + - getWindowHeight()) { this.fetchingDisabled = true; this.fetchTail(); } @@ -247,7 +260,7 @@ Lightbox.prototype.deleteSelection = function() { }; Lightbox.prototype._removeSelection = function() { - var i, e, slide; + var i, e; var toRemove = []; for (i=0 ; i