Mercurial > public > sg101
annotate media/js/slideshow.js @ 190:0e4961833cdf
Added some select_related's to downloads.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 01 Apr 2010 01:57:01 +0000 |
parents | a5b4c5ce0658 |
children |
rev | line source |
---|---|
bgneal@45 | 1 /*** |
bgneal@45 | 2 Simple jQuery Slideshow Script |
bgneal@45 | 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 :) |
bgneal@45 | 4 ***/ |
bgneal@45 | 5 // Modified by Brian Neal. |
bgneal@45 | 6 |
bgneal@45 | 7 function slideSwitch() { |
bgneal@45 | 8 var $active = $('#slideshow img.active'); |
bgneal@45 | 9 |
bgneal@45 | 10 if ( $active.length == 0 ) $active = $('#slideshow img:last'); |
bgneal@45 | 11 |
bgneal@45 | 12 // use this to pull the images in the order they appear in the markup |
bgneal@45 | 13 var $next = $active.next().length ? $active.next() |
bgneal@45 | 14 : $('#slideshow img:first'); |
bgneal@45 | 15 |
bgneal@45 | 16 $active.addClass('last-active'); |
bgneal@45 | 17 |
bgneal@45 | 18 $next.css({opacity: 0.0}) |
bgneal@45 | 19 .addClass('active') |
bgneal@45 | 20 .animate({opacity: 1.0}, 1000, function() { |
bgneal@45 | 21 $active.removeClass('active last-active'); |
bgneal@45 | 22 }); |
bgneal@45 | 23 } |
bgneal@45 | 24 |
bgneal@45 | 25 $(function() { |
bgneal@45 | 26 setInterval( "slideSwitch()", 5000 ); |
bgneal@45 | 27 }); |