1 (function () { 2 function () { 3 var Allpar = Array.prototype.slice.call (arguments); // get passed the parameters, break up the number of groups, such as have doubts about this can refer to my collection of "elegant Code" in the understanding of the use of JavaScript, call, bind the article, the author said the old good
4 varElem = allpar[0];5 varAllimg = allpar[1];6 if(Allimg.length > 0) {7$.each (Allimg,function(i,v) {8$ (elem). Append ("//add pictures to the specified container, first hide all the carousel pictures9 })Ten varIMGs = $ (elem). FIND ("img"); One varMoveimg = SetInterval (function() {//repeated execution of an infinite number of times, unless Clearinterval (moveimg); A varTindex = $ (elem). Find (". Sthis");//Display the unique label of the picture - if(Tindex.length > 0) { - if($ (Tindex.next ()). length>0) { the$ (Tindex.next ()). Show (). addclass ("Sthis"); -$ (Tindex.next ()). Siblings (). Hide (). Removeclass ("Sthis"); -}Else { -$ (imgs[0]). Show (). addclass ("Sthis"); +$ (imgs[0]). Siblings (). Hide (). Removeclass ("Sthis"); - } +}Else { A$ (imgs[0]). Show (). addclass ("Sthis"); at } -}, 1000) - } - } -}) (JQuery)
1 <Script>2 vararr= ["image/sf2-bg.jpg","Image/top_logo.png","Image/ken.png","Image/ken-tatsumaki-senpuu-kyaku.png"]3 $(function () {4 $("#login"). Click (function(){5 $( This). Moreimg ($ ("#cll"), arr);//call the function in the widget you wrote6 })7 8 })9 </Script>
Ten <div id= "CLL" > click </div>
Simple Carousel Diagram Widget