Posted By

Zedley on 03/16/11


Tagged


Versions (?)

Rotate on Click (jQuery)


 / Published in: JavaScript
 

  1. <ul class="rotater">
  2. <li class="active"><img src="null.jpg" /></li>
  3. <li><img src="null.jpg" /></li>
  4. <li><img src="null.jpg" /></li>
  5. <li><img src="null.jpg" /></li>
  6. </ul>
  7.  
  8. <script type="text/javascript">
  9. $('.rotater li').hide().eq(0).show().click(function() {
  10. b = $('rotater li').length;
  11. b--;
  12. a = $('.active').index('rotater li');
  13. $('.active').fadeOut().removeClass('active');
  14. if (a == b) {
  15. a = -1;
  16. }
  17. a++;
  18. $('.rotater li').index(a).fadeIn().addClass('active');
  19.  
  20. });

Report this snippet  

You need to login to post a comment.