Created
January 21, 2012 17:52
-
-
Save jsmesami/1653418 to your computer and use it in GitHub Desktop.
Very lightweight configurable jQuery slider plugin
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
$.fn.slides = function(options) { | |
var opts = $.extend({}, $.fn.slides.defaults, options); | |
return this.each(function() { | |
var $container = $(this); | |
function switcher() { | |
$container.find('img').first().css(opts.CSShidden).detach() | |
.appendTo($container).animate(opts.CSSvisible, opts.duration, opts.easing); | |
} | |
setInterval(switcher, opts.interval); | |
}); | |
}; | |
$.fn.slides.defaults = { | |
CSShidden: {opacity: 0}, | |
CSSvisible: {opacity: 1}, | |
duration: 1000, | |
interval: 10000, | |
easing: 'linear' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment