Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions dist/sly.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* sly 1.6.1 - 8th Aug 2015
* sly 1.6.1 - 24th Nov 2016
* https://github.com/darsain/sly
*
* Licensed under the MIT license.
Expand Down Expand Up @@ -630,7 +630,8 @@
* @return {Void}
*/
self.prev = function () {
self.activate(rel.activeItem == null ? 0 : rel.activeItem - 1);
var index = self.activate(rel.activeItem == null ? 0 : rel.activeItem - 1);
trigger('prev', index);
};

/**
Expand All @@ -639,7 +640,8 @@
* @return {Void}
*/
self.next = function () {
self.activate(rel.activeItem == null ? 0 : rel.activeItem + 1);
var index = self.activate(rel.activeItem == null ? 0 : rel.activeItem + 1);
trigger('next', index);
};

/**
Expand Down Expand Up @@ -770,10 +772,10 @@
*/
function getIndex(item) {
return item != null ?
isNumber(item) ?
item >= 0 && item < items.length ? item : -1 :
$items.index(item) :
-1;
isNumber(item) ?
item >= 0 && item < items.length ? item : -1 :
$items.index(item) :
-1;
}
// Expose getIndex without lowering the compressibility of it,
// as it is used quite often throughout Sly.
Expand Down Expand Up @@ -826,7 +828,7 @@
* @param {Mixed} item Item DOM element, or index starting at 0.
* @param {Bool} immediate Whether to reposition immediately in smart navigation.
*
* @return {Void}
* @return {Mixed}
*/
self.activate = function (item, immediate) {
var index = activate(item);
Expand All @@ -847,6 +849,7 @@
resetCycle();
}
}
return index;
};

/**
Expand Down Expand Up @@ -1225,7 +1228,7 @@
self.on(key, name[key]);
}
}
// Callback
// Callback
} else if (type(fn) === 'function') {
var names = name.split(' ');
for (var n = 0, nl = names.length; n < nl; n++) {
Expand All @@ -1234,7 +1237,7 @@
callbacks[names[n]].push(fn);
}
}
// Callbacks array
// Callbacks array
} else if (type(fn) === 'array') {
for (var f = 0, fl = fn.length; f < fl; f++) {
self.on(name, fn[f]);
Expand Down Expand Up @@ -2062,8 +2065,8 @@
|| fallback;

/**
* Fallback implementation.
*/
* Fallback implementation.
*/
var prev = new Date().getTime();
function fallback(fn) {
var curr = new Date().getTime();
Expand All @@ -2074,8 +2077,8 @@
}

/**
* Cancel.
*/
* Cancel.
*/
var cancel = w.cancelAnimationFrame
|| w.webkitCancelAnimationFrame
|| w.clearTimeout;
Expand Down
Loading