Created
November 29, 2009 12:51
-
-
Save kakra/244894 to your computer and use it in GitHub Desktop.
simple slideshow with script.aculo.us derived from http://www.andrewsellick.com/30/simple-javascript-slide-show-using-scriptaculous
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
#slide-images { | |
position: relative; | |
display: block; | |
margin: 0px; | |
padding: 0px; | |
width: 738px; | |
height: 234px | |
overflow: hidden; | |
} | |
#slide-images li { | |
position: absolute; | |
display: block; | |
list-style-type: none; | |
margin: 0px; | |
padding: 0px; | |
} | |
#slide-images li img { | |
display: block; | |
} |
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
var delay = 4000; | |
var start_frame = 0; | |
function start_slideshow(delay) { | |
setTimeout(fadeInOut(delay), delay); | |
} | |
function fadeInOut(delay) { | |
return(function() { | |
lis = $$('#slide-images>li'); | |
new Effect.Appear(lis[1], { duration: 2, afterFinish: function(obj) { | |
lisFade = lis[0].remove(); | |
lisFade.hide(); | |
$('slide-images').appendChild(lisFade); | |
start_slideshow(delay); | |
}}); | |
}) | |
} | |
Event.observe(document, 'dom:loaded', function() { | |
var lis = $$('#slide-images>li'); | |
if(lis.length > 1) for(i = 1; i < lis.length; i++) lis[i].hide(); | |
}); | |
Event.observe(window, 'load', function() { | |
if($$('#slide-images>li').length > 1) start_slideshow(delay); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment