{"version":3,"sources":["jquery.kxbdMarquee.js"],"names":["$","fn","kxbdMarquee","options","opts","extend","defaults","scrollFunc","$element","append","$kids","_type","scrollSize","loop","numMoved","scrollAmount","_scrollObj","direction","moveId","clearInterval","newPos","_dir","$marquee","this","get","width","scrollW","scrollH","css","isEqual","length","clone","setInterval","scrollDelay","hover","setDefaults","settings","jQuery"],"mappings":"cAqBA,SAAUA,GACTA,EAAEC,GAAGC,YAAY,SAASC,GAD1B,IAAAC,EAASJ,EAATK,UAAWL,EAAAC,GAAAC,YAAAI,SAAAH,GAEV,OAAIC,KAAKJ,KAAEK,WA6BV,SAAAE,IACAC,IAAAA,EAAgB,QAAPC,EAAOC,WAAmB,SAAAC,EAAAA,UAAnC,aAA0DC,YAKzD,GAAIR,EAAKS,KAAK,IAHfC,GAAIA,EAAJC,cACSR,EAAYH,EAAAS,KAEpB,OADAG,EAAUZ,GAAKa,EACNJ,cAAQK,GAIf,GAAOC,QAAPf,EAAAa,WAAA,MAAqBC,EAArBD,WACAG,EAAAJ,EAAAK,GAAAjB,EAAAW,eACDH,IAKCQ,GAAQR,GAFTI,EAAII,GAAOJ,MACRI,CACFA,IAAAA,EAAQR,EAARS,GAAAjB,EAAAW,aACAK,GAAA,IACDJ,GAAWK,GAEXL,EAAII,GAAOJ,GA/Cb,IAAIM,EAAStB,EAAEuB,MADhBP,EAAOM,EAAUE,IAAU,GACtBF,EAAAA,EAASG,QACTT,EAAAA,EAAWM,SACXI,EAAAA,EAAQJ,WACRK,EAAAA,EAAQL,WACRd,EAASc,EAKTX,EAAuB,QAAhBP,EAAKa,WAAmC,SAAhBb,EAAKa,UAAsB,EAAE,EAehE,GAZAT,EAASoB,IAAIjB,EAAM,QAAQ,SAAS,KAGjCP,EAAKyB,QADRjB,EAAAF,EAAAC,EAAA,aAAA,iBAAAD,EAAAoB,OAEClB,EAAAA,KAAAA,WADDA,GAEKZ,EAAAuB,MAAAZ,EAAA,aAAA,qBAOFC,GAAYD,EAAMe,EAAQC,IAA7B,CAAuCnB,EAAAC,OAAAC,EAAAqB,SAAAH,IAAAjB,EAAA,QAAA,SAAA,EAAAC,GAKvC,IAAIE,EAAS,EAuBXI,EAAAc,YAAAzB,EAAAH,EAAA6B,aAGFX,EAAAY,MAAA,WACAf,cAAWa,IAKT,WAHFb,cAAAD,GACAI,EAAAA,YAAef,EAAUH,EAAA6B,mBAKxBjC,EAAAC,GALDC,YAAAI,UAMAuB,SAlED,EAHDhB,KAAA,EA2ECI,UAAW,OAHZjB,aAAKE,EACJ2B,YAAQ,IAIRI,EAAAA,GAAAA,YAAgBE,YAAA,SAAAC,GAKhBpC,EAAEK,OAAQL,EAAEC,GAAGC,YAAYI,SAAU8B,IAnFvC,CAqFGC","file":"jquery.kxbdMarquee.js","sourcesContent":["/**\r\n * @classDescription 模拟Marquee,无间断滚动内容\r\n * @author Lyc 修改\r\n * @DOM\r\n * \t
\r\n * \t\t\r\n * \t
\r\n * @CSS\r\n * \t#marquee {overflow:hidden;width:200px;height:50px;}\r\n * @Usage\r\n * \t$(\"#marquee\").kxbdMarquee(options);\r\n * @options\r\n *\t\tisEqual:true,\t\t//所有滚动的元素长宽是否相等,true,false\r\n * \tloop:0,\t\t\t\t//循环滚动次数,0时无限\r\n *\t\tdirection:\"left\",\t//滚动方向,\"left\",\"right\",\"up\",\"down\"\r\n *\t\tscrollAmount:1,\t\t//步长\r\n *\t\tscrollDelay:20\t\t//时长\r\n */\r\n(function($){\r\n\t$.fn.kxbdMarquee=function(options){\r\n\t\tvar opts=$.extend({},$.fn.kxbdMarquee.defaults, options);\r\n\r\n\t\treturn this.each(function(){\r\n\t\t\tvar $marquee=$(this);\t\t\t\t//滚动元素容器\r\n\t\t\tvar _scrollObj=$marquee.get(0);\t\t//滚动元素容器DOM\r\n\t\t\tvar scrollW=$marquee.width();\t\t//滚动元素容器的宽度\r\n\t\t\tvar scrollH=$marquee.height();\t\t//滚动元素容器的高度\r\n\t\t\tvar $element=$marquee.children();\t//滚动元素\r\n\t\t\tvar $kids=$element.children();\t\t//滚动子元素\r\n\t\t\tvar scrollSize=0;\t\t\t\t\t//滚动元素尺寸\r\n\r\n\t\t\t//滚动类型,1左右,0上下\r\n\t\t\tvar _type=(opts.direction==\"left\"||opts.direction==\"right\") ? 1:0;\r\n\r\n\t\t\t//防止滚动子元素比滚动元素宽而取不到实际滚动子元素宽度\r\n\t\t\t$element.css(_type?\"width\":\"height\",10000);\r\n\r\n\t\t\t//获取滚动元素的尺寸\r\n\t\t\tif(opts.isEqual){\r\n\t\t\t\tscrollSize=$kids[_type?\"outerWidth\":\"outerHeight\"]()*$kids.length;\r\n\t\t\t}else{\r\n\t\t\t\t$kids.each(function(){\r\n\t\t\t\t\tscrollSize+=$(this)[_type?\"outerWidth\":\"outerHeight\"]();\r\n\t\t\t\t});\r\n\t\t\t};\r\n\r\n\t\t\t//滚动元素总尺寸小于容器尺寸,不滚动\r\n\t\t\tif(scrollSize<(_type?scrollW:scrollH)){return;}; \r\n\r\n\t\t\t//克隆滚动子元素将其插入到滚动元素后,并设定滚动元素宽度\r\n\t\t\t$element.append($kids.clone()).css(_type?\"width\":\"height\",scrollSize*2);\r\n\r\n\t\t\tvar numMoved=0;\r\n\t\t\tfunction scrollFunc(){\r\n\t\t\t\tvar _dir=(opts.direction==\"left\"||opts.direction==\"right\") ? \"scrollLeft\":\"scrollTop\";\r\n\t\t\t\tif (opts.loop>0) {\r\n\t\t\t\t\tnumMoved+=opts.scrollAmount;\r\n\t\t\t\t\tif(numMoved>scrollSize*opts.loop){\r\n\t\t\t\t\t\t_scrollObj[_dir]=0;\r\n\t\t\t\t\t\treturn clearInterval(moveId);\r\n\t\t\t\t\t};\r\n\t\t\t\t};\r\n\r\n\t\t\t\tif(opts.direction==\"left\"||opts.direction==\"up\"){\r\n\t\t\t\t\tvar newPos=_scrollObj[_dir]+opts.scrollAmount;\r\n\t\t\t\t\tif(newPos>=scrollSize){\r\n\t\t\t\t\t\tnewPos-=scrollSize;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t_scrollObj[_dir]=newPos;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tvar newPos=_scrollObj[_dir]-opts.scrollAmount;\r\n\t\t\t\t\tif(newPos<=0){\r\n\t\t\t\t\t\tnewPos += scrollSize;\r\n\t\t\t\t\t};\r\n\t\t\t\t\t_scrollObj[_dir]=newPos;\r\n\t\t\t\t};\r\n\t\t\t};\r\n\r\n\t\t\t//滚动开始\r\n\t\t\tvar moveId=setInterval(scrollFunc, opts.scrollDelay);\r\n\r\n\t\t\t//鼠标划过停止滚动\r\n\t\t\t$marquee.hover(function(){\r\n\t\t\t\tclearInterval(moveId);\r\n\t\t\t},function(){\r\n\t\t\t\tclearInterval(moveId);\r\n\t\t\t\tmoveId=setInterval(scrollFunc, opts.scrollDelay);\r\n\t\t\t});\r\n\t\t});\r\n\t};\r\n\r\n\t$.fn.kxbdMarquee.defaults={\r\n\t\tisEqual:true,\t\t//所有滚动的元素长宽是否相等,true,false\r\n\t\tloop: 0,\t\t\t//循环滚动次数,0时无限\r\n\t\tdirection: \"left\",\t//滚动方向,\"left\",\"right\",\"up\",\"down\"\r\n\t\tscrollAmount:1,\t\t//步长\r\n\t\tscrollDelay:20\t\t//时长\r\n\r\n\t};\r\n\r\n\t$.fn.kxbdMarquee.setDefaults=function(settings) {\r\n\t\t$.extend( $.fn.kxbdMarquee.defaults, settings );\r\n\t};\r\n})(jQuery);"],"sourceRoot":"D:\\phpStudy\\WWW\\template\\template\\default\\index/source/js"}