原文引用http://www.oschina.net/code/snippet_268286_11424
01 | $(document).ready( function () { |
03 | var inAnimation = false ; |
04 | $( '#box img' ).each( function () { |
06 | $( this ).css( 'z-index' , z); |
09 | 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 () { |
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); |
25 | $( this ).animate({left: "0px" }, 600, function () { |
26 | $( this ).css( 'z-index' , parseInt($( this ).css( 'z-index' )) + 1); |
32 | $( '#box' ).click( function () { |