一晃端午节又过去了,又得开始新的工作累人啊。

这两天jquery博客有不少感慨,感觉人有时要是言而无信,那不管做什么事情都不会成功的,觉得,既然说出口了,或者,暗暗下决心做了,就一定做成功。如果不行,那是自己的责任。不多说了,做个类似QQ管家页面jquery图片显隐轮换效果,感觉在哪个页面中看到过,反正是腾讯的,故加个类似。

 

  1. $(document).ready(function() { 
  2. var z = 0; 
  3. var inAnimation = false
  4. $('#box img').each(function() { 
  5. z++; 
  6. $(this).css('z-index', z); 
  7. }); 
  8. function slide() { 
  9. if(inAnimation) return false
  10. else inAnimation = true
  11. var MaxZindex = z; SecondZindex = z-1; 
  12. $('#box img').each(function() { 
  13. if($(this).css('z-index') == MaxZindex) { 
  14. $(this).animate({left:"350px"}, 800, function() { 
  15. $(this).css('z-index', 1) 
  16. .animate({left:"0px"}, 800, function() { 
  17. inAnimation = false
  18. }); 
  19. }); 
  20. else if($(this).css('z-index') == SecondZindex) { 
  21. $(this).animate({left:"-80px"}, 800, function() { 
  22. $(this).css('z-index', parseInt($(this).css('z-index')) + 1); 
  23. }).animate({left:"0px"}, 800); 
  24. }else
  25. $(this).animate({left:"0px"}, 600, function() { 
  26. $(this).css('z-index', parseInt($(this).css('z-index')) + 1); 
  27. }); 
  28. }); 
  29. return false
  30. $('#box').click(function() { 
  31. slide(); 
  32. }); 
  33. }); 

在线效果DEMO

http://www.jqueryba.com/475.html