Skip to content

Instantly share code, notes, and snippets.

@joecritch
Created April 19, 2011 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joecritch/929361 to your computer and use it in GitHub Desktop.
Save joecritch/929361 to your computer and use it in GitHub Desktop.
Souped-up call!
$('.carousel ul').each(function() {
var ul = $(this);
ul.simpleScroll({
auto_slide: 1,
hover_pause: 1
});
// Aha! There's our data object we created inside the plugin. Luckily, this gives us access to everything that SimpleScroll had to offer.
var api = ul.data('simpleScroll');
// Here's an example of how you could create previous and next buttons to go along with your plugin...
ul.closest('.carousel').find('.prev').click(function(e) {
// Access the slide function directly from the api variable. Very simple.
api.slide('left');
e.preventDefault();
});
ul.closest('.carousel').find('.next').click(function(e) {
api.slide('right');
e.preventDefault();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment