Skip to content

Commit 9459260

Browse files
Martijn van der LeeMartijn van der Lee
Martijn van der Lee
authored and
Martijn van der Lee
committed
Added before event
1 parent 9f6f8f7 commit 9459260

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
jQuery Coverflow
22
================
3-
Version 1.3.3
3+
Version 1.3.4
44

5-
Copyright © 2013-2016 Martijn van der Lee (http://martijn.vanderlee.com).
5+
Copyright © 2013-2017 Martijn van der Lee (http://martijn.vanderlee.com).
66
MIT Open Source license applies.
77

88
Yet another jQuery Coverflow widget.
@@ -180,6 +180,11 @@ or removing covers or changing the covers yourself.
180180

181181
Events
182182
------
183+
### **before**
184+
Triggered just before moving the coverflow to a new index.
185+
186+
Callback: `function(event, cover, index)`
187+
183188
### **change**
184189
Triggered whenever the current cover index changes. This includes initially and
185190
for each cover passed by when skipping past multiple covers. Change triggers as

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coverflow",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"homepage": "https://github.com/vanderlee/coverflow",
55
"authors": [
66
"Martijn van der Lee <[email protected]>"

demo.html

+8-5
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138

139139
$('.photos').coverflow({
140140
easing: 'easeOutElastic',
141-
duration: 'slow',
141+
duration: 1000,
142142
index: 3,
143143
width: 320,
144144
height: 240,
@@ -150,11 +150,14 @@
150150
console.log('Confirm');
151151
},
152152

153-
change: function(event, cover) {
153+
before: function() {
154+
$('#photos-name').stop(true).fadeOut('fast');
155+
},
156+
157+
select: function(event, cover) {
154158
var img = $(cover).children().andSelf().filter('img').last();
155-
$('#photos-name').text(img.data('name') || 'unknown');
156-
}
157-
159+
$('#photos-name').text(img.data('name') || 'unknown').stop(true).fadeIn('fast');
160+
},
158161
});
159162

160163
$('#leakdetect').click(function() {

jqcoverflow.jquery.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jqcoverflow",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"title": "Vanderlee Coverflow",
55
"description": "A jQuery-based Coverflow components with optional mousewheel, CSS3 interpolation, transformations, touch swipe, reflections and more.",
66
"author": {

jquery.coverflow.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
$.widget("vanderlee.coverflow", {
3939
options: {
4040
animateComplete: undefined,
41+
animateStart: undefined,
4142
animateStep: undefined,
4243
density: 1,
4344
duration: 'normal',
@@ -325,12 +326,10 @@
325326
'transform': transform
326327
}));
327328

328-
// Optional callback
329329
that._trigger('animateStep', null, [cover, offset, isVisible, isMiddle, sin, cos]);
330330

331331
if (frame == that.options.index) {
332-
// Optional callback
333-
that._trigger('animateComplete', null, [cover, offset, isVisible, isMiddle, sin, cos]);
332+
that._trigger('animateComplete', null, [cover, offset, isVisible, isMiddle, sin, cos]);
334333
}
335334
});
336335
},
@@ -342,6 +341,8 @@
342341
covercount = covers.length,
343342
triggered = false;
344343

344+
that._callback('before');
345+
345346
covers.css('position', 'absolute');
346347
that.element.stop().animate({
347348
'__coverflow_frame': index || that.options.index
@@ -362,6 +363,8 @@
362363
},
363364
'complete': function() {
364365
that.currentIndex = that.options.index;
366+
that._callback('after');
367+
365368
if (!triggered) {
366369
that._callback('change');
367370
}

0 commit comments

Comments
 (0)