/*<div id= "Ads" > <div> <ul> <li><a href= "#" target= "_blank" ></a></li> <li><a href=" # "target=" _blank "></a></li> <li><a href=" # "target=" _blank "></a></li> </ul> <div> <div class=" Pre_left " ></div> <div class=" next_right "></div> </div> </div><ul><li class=" Focus "></li> ; <li></li><li class= "Lastli" ></li></ul></div>*/;(function () {var collection = { $ads: $ ("#ads"), $adsContent: $ ("#ads >div>ul>li"),//Large AD $arrows: $ ("#ads >div>div>div") ,//Toggle Arrow $markPoints:$ ("#ads >ul>li"),//Small dot hidetime:400,//vanishing time showtime:800,//time intervaltime:4000//interval}, Len = collection. $adsContent. Length; Collection. $ads. Hover (function () {collection. $arrows. FadeIn ("Fast"). CSS ("display", "Inline-block"); },function () {collection. $arrows. FadeOut ("fast"); }); Loop right Toggles function AutoPlay () {Turntolorr (true,false); } var _setinterval=setinterval (autoplay,collection. IntervalTime); Click the arrows to toggle the collection. $arrows. Each (function (index) {if (index==0) {$ (this). On ("click", Function () { Turntolorr (false,true); }); } else{$ (this). On ("click", Function () {Turntolorr (true,true); }); }})//Click on small dots to toggle collection. $markPoints. Each (function (index) {$ (this). On ("click", Function () {collection. $adsC). Ontent.stop (false,true); if (!collection. $adsContent. Is (": Animated")) {clearinterval (_setinterval); var $target = collection. $adsContent. EQ (index); Animate ($target, true); Animate ($target. Siblings (), false); Markdot (collection. $markPoints. EQ (index)); _setinterval=setinterval (function () {AutoPlay (collection. $adsContent)},collection. IntervalTime); })})//Toggle function Turntolorr (Directionisright,clicklorr) {if (Clicklorr) collection. $adsContent. St OP (false,true); if (!collection. $adsContent. Is (": Animated")) {if (Clicklorr) clearinterval (_setinterval); Collection. $adsContent. Each (function (index) {if ("search") {animate (this), false); if (directionisright) {if (Index+1<len) {Animate ($ (this). Next (), true); Markdot (collection. $markPoints. EQ (index+1)); } else{animate (collection. $adsContent. EQ (0), true); Markdot (collection. $markPoints. EQ (0)); }} else{ if (index-1>=0) {Animate ($ (this). Prev (), true); Markdot (collection. $markPoints. EQ (index-1)); } else{animate (collection. $adsContent. EQ (len-1), true); Markdot (collection. $markPoints. EQ (len-1)); }} if (Clicklorr) _setinterval=setinterval (autoplay,collection. IntervalTime); return false; } }); }}//is responsible for marking dot function Markdot ($target) {$target. addclass ("Focus"). Siblings (). Removeclass ("Focus"); }//is responsible for judging the current large ad function search ($target) {if ($target. CSS ("Z-index") ==1) return true; else return false; }//is responsible for animating function animate ($target, show) {if (show) $target. CSS ("Z-index", "1"). Animate ({opacity:1,filter: "ALP Ha (opacity=100) "},collection. SHOWTIME); else $target. Animate ({opacity:0,filter: "Alpha (opacity=0)"},collection. Showtime,function () {$ (this). CSS ("Z-index", "1")}); }})()
The fade-out-of-present carousel based on jquery