Skip to content

Instantly share code, notes, and snippets.

@tylr
Created August 10, 2011 02:21
Show Gist options
  • Save tylr/1135924 to your computer and use it in GitHub Desktop.
Save tylr/1135924 to your computer and use it in GitHub Desktop.
function offset_current_by(offset) {
return _slides[offset_index(offset)];
};
function offset_index(offset) {
var last = _slides.length - 1;
var idx = index_of(_current) + offset;
idx = (idx >= 0) ? idx : last + idx;
idx = (idx <= last) ? idx : idx - last;
return idx;
};
function next() {
change_slide(offset_current_by(1));
};
function prev() {
change_slide(offset_current_by(-1));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment