|
21 | 21 | afterShowLightbox: function(lightbox){}, |
22 | 22 | beforeHideLightbox: function(){}, |
23 | 23 | afterHideLightbox: function(){}, |
| 24 | + beforePrev: function(element){}, |
24 | 25 | onPrev: function(element){}, |
| 26 | + beforeNext: function(element){}, |
25 | 27 | onNext: function(element){}, |
26 | 28 | errorMessage: 'The requested content cannot be loaded. Please try again later.' |
27 | 29 | }; |
|
100 | 102 | var index = galleryItems.index(currentLink); |
101 | 103 | currentLink = galleryItems.eq(index - 1); |
102 | 104 | 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 | + }); |
105 | 109 | }); |
106 | 110 |
|
107 | 111 | // Next |
|
110 | 114 | var index = galleryItems.index(currentLink); |
111 | 115 | currentLink = galleryItems.eq(index + 1); |
112 | 116 | 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 | + }); |
115 | 121 | }); |
116 | 122 | } |
117 | 123 |
|
|
0 commit comments