Skip to content
This repository was archived by the owner on Apr 15, 2021. It is now read-only.

Commit c7eee44

Browse files
authored
Merge pull request #43 from emirpprime/master
Add Options to allow gallery transitions
2 parents 123b83d + e57c4d3 commit c7eee44

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

nivo-lightbox.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
afterShowLightbox: function(lightbox){},
2222
beforeHideLightbox: function(){},
2323
afterHideLightbox: function(){},
24+
beforePrev: function(element){},
2425
onPrev: function(element){},
26+
beforeNext: function(element){},
2527
onNext: function(element){},
2628
errorMessage: 'The requested content cannot be loaded. Please try again later.'
2729
};
@@ -100,8 +102,10 @@
100102
var index = galleryItems.index(currentLink);
101103
currentLink = galleryItems.eq(index - 1);
102104
if(!$(currentLink).length) currentLink = galleryItems.last();
103-
$this.processContent(content, currentLink);
104-
$this.options.onPrev.call(this, [ currentLink ]);
105+
$.when($this.options.beforePrev.call(this, [ currentLink ])).done(function(){
106+
$this.processContent(content, currentLink);
107+
$this.options.onPrev.call(this, [ currentLink ]);
108+
});
105109
});
106110

107111
// Next
@@ -110,8 +114,10 @@
110114
var index = galleryItems.index(currentLink);
111115
currentLink = galleryItems.eq(index + 1);
112116
if(!$(currentLink).length) currentLink = galleryItems.first();
113-
$this.processContent(content, currentLink);
114-
$this.options.onNext.call(this, [ currentLink ]);
117+
$.when($this.options.beforeNext.call(this, [ currentLink ])).done(function(){
118+
$this.processContent(content, currentLink);
119+
$this.options.onNext.call(this, [ currentLink ]);
120+
});
115121
});
116122
}
117123

0 commit comments

Comments
 (0)