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
26 changes: 14 additions & 12 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 - 2nd Jan 2017
* https://github.com/darsain/sly
*
* Licensed under the MIT license.
Expand Down Expand Up @@ -373,6 +373,7 @@
* @return {Void}
*/
function slideTo(newPos, immediate, dontAlign) {
dontAlign = dontAlign || o.dontAlign;
// Align items
if (itemNav && dragging.released && !dontAlign) {
var tempRel = getRelatives(newPos);
Expand Down Expand Up @@ -672,7 +673,7 @@
if (!delta) {
return;
}
if (itemNav) {
if (itemNav && !o.dontAlign) {
self[centeredNav ? 'toCenter' : 'toStart'](
within((centeredNav ? rel.centerItem : rel.firstItem) + o.scrollBy * delta, 0, items.length)
);
Expand Down Expand Up @@ -770,10 +771,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 @@ -1225,7 +1226,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 +1235,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 +2063,8 @@
|| fallback;

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

/**
* Cancel.
*/
* Cancel.
*/
var cancel = w.cancelAnimationFrame
|| w.webkitCancelAnimationFrame
|| w.clearTimeout;
Expand Down Expand Up @@ -2154,6 +2155,7 @@
scrollBy: 0, // Pixels or items to move per one mouse scroll. 0 to disable scrolling.
scrollHijack: 300, // Milliseconds since last wheel event after which it is acceptable to hijack global scroll.
scrollTrap: false, // Don't bubble scrolling when hitting scrolling limits.
dontAlign: false, // Don't align the items within the box edges.

// Dragging
dragSource: null, // Selector or DOM element for catching dragging events. Default is FRAME.
Expand Down
Loading