Skip to content

Instantly share code, notes, and snippets.

@jsmesami
Created January 21, 2012 17:52
Show Gist options
  • Save jsmesami/1653418 to your computer and use it in GitHub Desktop.
Save jsmesami/1653418 to your computer and use it in GitHub Desktop.
Very lightweight configurable jQuery slider plugin
$.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