Skip to content

Instantly share code, notes, and snippets.

@ahsquared
Created December 14, 2012 02:31
Show Gist options
  • Save ahsquared/4282065 to your computer and use it in GitHub Desktop.
Save ahsquared/4282065 to your computer and use it in GitHub Desktop.
jQuery tools scrollable doesn't handle scrolling one at a time but showing multiples, this fixes that.
$('#divMonthsOuter .scrollable').scrollable({
circular: false,
onSeek: function (event, index) {
var next = this.getRoot().siblings('.next');
// the 6 here is the number of items showing
if (this.getIndex() >= this.getSize() - 6) {
// Disable the Next link
next.addClass('disabled');
} else {
next.removeClass('disabled');
}
},
onBeforeSeek: function (event, index) {
var newIndex = this.getIndex();
// the 6 here is the number of items showing
if (this.getIndex() >= this.getSize() - 6) {
if (index > newIndex) {
return false;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment