/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<ul class="rotater"> <li class="active"><img src="null.jpg" /></li> <li><img src="null.jpg" /></li> <li><img src="null.jpg" /></li> <li><img src="null.jpg" /></li> </ul> <script type="text/javascript"> $('.rotater li').hide().eq(0).show().click(function() { b = $('rotater li').length; b--; a = $('.active').index('rotater li'); $('.active').fadeOut().removeClass('active'); if (a == b) { a = -1; } a++; $('.rotater li').index(a).fadeIn().addClass('active'); });