Created
April 19, 2011 19:25
-
-
Save joecritch/929361 to your computer and use it in GitHub Desktop.
Souped-up call!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.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