Skip to content

Instantly share code, notes, and snippets.

@tmeasday
Created February 23, 2012 03:53
Show Gist options
  • Save tmeasday/1889939 to your computer and use it in GitHub Desktop.
Save tmeasday/1889939 to your computer and use it in GitHub Desktop.
$element.on('click', '.next', function() {
// find the next frame that isn't completely on the screen
var $next_frame = $element.find('.frame').filter(function() {
return $(this).position().left + $(this).width() > $element.scrollLeft() + $element.width();
}).eq(0)
// scroll it into view
$element.scrollTo($next_frame, 'medium');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment