Mercurial > public > sg101
comparison media/js/slideshow.js @ 45:a5b4c5ce0658
Breaking down and controlling all media files, including javascript libraries.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 19 Jun 2009 03:16:03 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
44:08cd19c1ee50 | 45:a5b4c5ce0658 |
---|---|
1 /*** | |
2 Simple jQuery Slideshow Script | |
3 Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc. Please link out to me if you like it :) | |
4 ***/ | |
5 // Modified by Brian Neal. | |
6 | |
7 function slideSwitch() { | |
8 var $active = $('#slideshow img.active'); | |
9 | |
10 if ( $active.length == 0 ) $active = $('#slideshow img:last'); | |
11 | |
12 // use this to pull the images in the order they appear in the markup | |
13 var $next = $active.next().length ? $active.next() | |
14 : $('#slideshow img:first'); | |
15 | |
16 $active.addClass('last-active'); | |
17 | |
18 $next.css({opacity: 0.0}) | |
19 .addClass('active') | |
20 .animate({opacity: 1.0}, 1000, function() { | |
21 $active.removeClass('active last-active'); | |
22 }); | |
23 } | |
24 | |
25 $(function() { | |
26 setInterval( "slideSwitch()", 5000 ); | |
27 }); |