Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Very basic slide show using jquery.
Simple continuous slide show using JQuery.
<div id="slides">
<div class="slide">First</div>
<div class="slide">Second</div>
<div class="slide">Third</div>
<script type="application/javascript">$("#slides").slide({delay: 5000});</script>
Copyright (c) 2011 - R.W. van 't Veer
(function ($) {
$.fn.slide = function(options) {
var options = $.extend({delay: 2000}, options);
return this.each(function () {
var container = $(this).css({
position: "relative"
var slides = $(this).find(".slide").css({
position: "absolute"
var slider = function() {
var current = $(this), next = $(this).next(".slide");
if (next.size() == 0) {
next = $(this).parent().children(".slide").first();
setTimeout(function() {
current.css({zIndex: 2}).show();
next.css({zIndex: 1}).show().animate({},
{complete: slider},
}, options.delay);
slides.first().animate({}, {complete: slider}, options.delay);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.