请教 2个JS代码冲突 导致只有其中一个有效

问题描述

<script>window.addEvent('domready',function(e){$('widwidgets_5162_style').inject($E('link'),'before');varcats=$ES('.DuceDropNavs.m-cat-depth-1');if(!cats[0])return;cats.each(function(cat,i){varpopup=cat.getElement('.m-cat-popup');if(popup){cat.addEvents({'mouseenter':function(){this.addClass('current');varli=this.getSize();popup.setStyles({'display':'block','margin':'-'+li.y+'px00'+(li.x-22)+'px'});},'mouseleave':function(){this.removeClass('current');popup.setStyle('display','none');}});}});})</script>

(function(a){a.flexslider=function(c,b){vard=c;d.init=function(){d.vars=a.extend({},a.flexslider.defaults,b);d.data("flexslider",true);d.container=a(".slides",d);d.slides=a(".slides>li",d);d.count=d.slides.length;d.animating=false;d.currentSlide=d.vars.slideToStart;d.atEnd=(d.currentSlide==0)?true:false;d.eventType=("ontouchstart"indocument.documentElement)?"touchstart":"click";d.cloneCount=0;d.cloneOffset=0;if(d.vars.controlsContainer!=""){d.controlsContainer=a(d.vars.controlsContainer).eq(a(".slides").index(d.container));d.containerExists=d.controlsContainer.length>0}if(d.vars.manualControls!=""){d.manualControls=a(d.vars.manualControls,((d.containerExists)?d.controlsContainer:d));d.manualExists=d.manualControls.length>0}if(d.vars.randomize){d.slides.sort(function(){return(Math.round(Math.random())-0.5)});d.container.empty().append(d.slides)}if(d.vars.animation.toLowerCase()=="slide"){d.css({overflow:"hidden"});if(d.vars.animationLoop){d.cloneCount=2;d.cloneOffset=1;d.container.append(d.slides.filter(":first").clone().addClass("clone")).prepend(d.slides.filter(":last").clone().addClass("clone"))}d.container.width(((d.count+d.cloneCount)*d.width())+2000);d.newSlides=a(".slides>li",d);setTimeout(function(){d.newSlides.width(d.width()).css({"float":"left"}).show()},100);d.container.css({marginLeft:(-1*(d.currentSlide+d.cloneOffset))*d.width()+"px"})}else{d.slides.css({width:"100%","float":"left",marginRight:"-100%"}).filter(":first").fadeIn(400,function(){})}if(d.vars.controlNav){if(d.manualExists){d.controlNav=d.manualControls}else{varg=a('<olclass="flex-control-nav"></ol>');vark=1;for(varl=0;l<d.count;l++){g.append("<li><a>"+k+"</a></li>");k++}if(d.containerExists){a(d.controlsContainer).append(g);d.controlNav=a(".flex-control-navlia",d.controlsContainer)}else{d.append(g);d.controlNav=a(".flex-control-navlia",d)}}d.controlNav.eq(d.currentSlide).addClass("active");d.controlNav.bind(d.eventType,function(i){i.preventDefault();if(!a(this).hasClass("active")){d.flexAnimate(d.controlNav.index(a(this)),d.vars.pauseOnAction)}})}if(d.vars.directionNav){varf=a('<ulclass="flex-direction-nav"><li><aclass="prev"href="#">'+d.vars.prevText+'</a></li><li><aclass="next"href="#">'+d.vars.nextText+"</a></li></ul>");if(d.containerExists){a(d.controlsContainer).append(f);d.directionNav=a(".flex-direction-navlia",d.controlsContainer)}else{d.append(f);d.directionNav=a(".flex-direction-navlia",d)}if(!d.vars.animationLoop){if(d.currentSlide==0){d.directionNav.filter(".prev").addClass("disabled")}else{if(d.currentSlide==d.count-1){d.directionNav.filter(".next").addClass("disabled")}}}d.directionNav.bind(d.eventType,function(i){i.preventDefault();varj=(a(this).hasClass("next"))?d.getTarget("next"):d.getTarget("prev");if(d.canAdvance(j)){d.flexAnimate(j,d.vars.pauseOnAction)}})}if(d.vars.keyboardNav&&a("ul.slides").length==1){a(document).keyup(function(i){if(d.animating){return}else{if(i.keyCode!=39&&i.keyCode!=37){return}else{if(i.keyCode==39){varj=d.getTarget("next")}else{if(i.keyCode==37){varj=d.getTarget("prev")}}if(d.canAdvance(j)){d.flexAnimate(j,d.vars.pauseOnAction)}}}})}if(d.vars.slideshow){if(d.vars.pauseOnHover&&d.vars.slideshow){d.hover(function(){d.pause()},function(){d.resume()})}d.animatedSlides=setInterval(d.animateSlides,d.vars.slideshowSpeed)}if(d.vars.pausePlay){vare=a('<divclass="flex-pauseplay"><span></span></div>');if(d.containerExists){d.controlsContainer.append(e);d.pausePlay=a(".flex-pauseplayspan",d.controlsContainer)}else{d.append(e);d.pausePlay=a(".flex-pauseplaylia",d)}varh=(d.vars.slideshow)?"pause":"play";d.pausePlay.addClass(h).text(h);d.pausePlay.click(function(i){i.preventDefault();(a(this).hasClass("pause"))?d.pause():d.resume()})}if(d.vars.touchSwipe&&"ontouchstart"indocument.documentElement){d.each(function(){vari,j=20;isMoving=false;functiono(){this.removeEventListener("touchmove",m);i=null;isMoving=false}functionm(s){if(isMoving){varp=s.touches[0].pageX,q=i-p;if(Math.abs(q)>=j){o();varr=(q>0)?d.getTarget("next"):d.getTarget("prev");if(d.canAdvance(r)){d.flexAnimate(r,d.vars.pauseOnAction)}}}}functionn(p){if(p.touches.length==1){i=p.touches[0].pageX;isMoving=true;this.addEventListener("touchmove",m,false)}}if("ontouchstart"indocument.documentElement){this.addEventListener("touchstart",n,false)}})}if(d.vars.animation.toLowerCase()=="slide"){d.sliderTimer;a(window).resize(function(){d.newSlides.width(d.width());d.container.width(((d.count+d.cloneCount)*d.width())+2000);clearTimeout(d.sliderTimer);d.sliderTimer=setTimeout(function(){d.flexAnimate(d.currentSlide)},300)})}d.vars.start(d)};d.flexAnimate=function(f,e){if(!d.animating){d.animating=true;if(e){d.pause()}if(d.vars.controlNav){d.controlNav.removeClass("active").eq(f).addClass("active")}d.atEnd=(f==0||f==d.count-1)?true:false;if(!d.vars.animationLoop){if(f==0){d.directionNav.removeClass("disabled").filter(".prev").addClass("disabled")}else{if(f==d.count-1){d.directionNav.removeClass("disabled").filter(".next").addClass("disabled");d.pause();d.vars.end(d)}else{d.directionNav.removeClass("disabled")}}}d.vars.before(d);if(d.vars.animation.toLowerCase()=="slide"){if(d.currentSlide==0&&f==d.count-1&&d.vars.animationLoop){d.slideString="0px"}else{if(d.currentSlide==d.count-1&&f==0&&d.vars.animationLoop){d.slideString=(-1*(d.count+1))*d.slides.filter(":first").width()+"px"}else{d.slideString=(-1*(f+d.cloneOffset))*d.slides.filter(":first").width()+"px"}}d.container.animate({marginLeft:d.slideString},d.vars.animationDuration,function(){if(d.currentSlide==0&&f==d.count-1&&d.vars.animationLoop){d.container.css({marginLeft:(-1*d.count)*d.slides.filter(":first").width()+"px"})}else{if(d.currentSlide==d.count-1&&f==0&&d.vars.animationLoop){d.container.css({marginLeft:-1*d.slides.filter(":first").width()+"px"})}}d.animating=false;d.currentSlide=f;d.vars.after(d)})}else{d.slides.eq(d.currentSlide).fadeOut(d.vars.animationDuration);d.slides.eq(f).fadeIn(d.vars.animationDuration,function(){d.animating=false;d.currentSlide=f;d.vars.after(d)})}}};d.animateSlides=function(){if(!d.animating){vare=(d.currentSlide==d.count-1)?0:d.currentSlide+1;d.flexAnimate(e)}};d.pause=function(){clearInterval(d.animatedSlides);if(d.vars.pausePlay){d.pausePlay.removeClass("pause").addClass("play").text("play")}};d.resume=function(){d.animatedSlides=setInterval(d.animateSlides,d.vars.slideshowSpeed);if(d.vars.pausePlay){d.pausePlay.removeClass("play").addClass("pause").text("pause")}};d.canAdvance=function(e){if(!d.vars.animationLoop&&d.atEnd){if(d.currentSlide==0&&e==d.count-1&&d.direction!="next"){returnfalse}else{if(d.currentSlide==d.count-1&&e==0&&d.direction=="next"){returnfalse}else{returntrue}}}else{returntrue}};d.getTarget=function(e){d.direction=e;if(e=="next"){return(d.currentSlide==d.count-1)?0:d.currentSlide+1}else{return(d.currentSlide==0)?d.count-1:d.currentSlide-1}};d.init()};a.flexslider.defaults={animation:"fade",slideshow:true,slideshowSpeed:7000,animationDuration:600,directionNav:true,controlNav:true,keyboardNav:true,touchSwipe:true,prevText:"Previous",nextText:"Next",pausePlay:false,randomize:false,slideToStart:0,animationLoop:true,pauseOnAction:true,pauseOnHover:false,controlsContainer:"",manualControls:"",start:function(){},before:function(){},after:function(){},end:function(){}};a.fn.flexslider=function(b){returnthis.each(function(){if(a(this).find(".slidesli").length==1){a(this).find(".slidesli").fadeIn(400)}else{if(a(this).data("flexslider")!=true){newa.flexslider(a(this),b)}}})}})(jQuery);

请教高手该如何改呀本人刚刚入门这个

解决方案

时间: 2024-09-25 15:56:27

请教 2个JS代码冲突 导致只有其中一个有效的相关文章

从JS代码来建设网站用户体验度

中介交易 http://www.aliyun.com/zixun/aggregation/6858.html">SEO诊断 淘宝客 云主机 技术大厅 在今天早上跟一个资深的老站长探讨了最新的网站优化形式及网站用户体验度的最新建设规则,下午小编就把今天探讨得出来的结论给大家做一个相关的总结来分享给大家! 如今的优化可谓是越来越正规,优化这个行业的竞争也是越来越激烈了.那么百度最近最注重的就是网站的用户体验度了,根据一些知名的SEO培训专家所总结而来的经验说明,网站的关键词排名在前二十名进入到

复制到剪切板js代码兼容 IE 与 Firefox

下面这个代码是我自己最常用的  代码如下 复制代码 <title>JS复制到剪切板</title> </head> <script> function showDivLinkCopy() {  var msg=document.getElementById("text").value;     window.clipboardData.setData("Text",msg);  } </script> &l

请求阻塞-ajax请求过多导致js代码阻塞问题,求助

问题描述 ajax请求过多导致js代码阻塞问题,求助 首先,我有这么一个需求. 需求:遍历局域网内所有IP查找服务器IP. 实现:通过for循环向每个IP发送ajax请求,前端成功接受到服务器返回的数据说明当前请求的IP为服务器IP地址. 问题:由于向局域网内所有IP都同时发送了ajax请求,一共250多次,导致js代码以及ajax请求阻塞. 有没有什么比较好的办法能够解决ajax请求不响应的问题.. 贴一下代码 for(var i = 0;i<ipUseableArray.length;i++

js代码,google浏览器执行1s,IE浏览器内执行,导致ie直接未响应

问题描述 js代码,google浏览器执行1s,IE浏览器内执行,导致ie直接未响应 一段js代码,在google浏览器下执行速度大概在1s左右,但是在IE浏览器内执行,导致ie直接未响应,.主要是想找一个精通JS的,将js进行优化,从而达到ie下执行速度和google下速度基本差不多的情况.能进行QQ远程协助并且沟通. 本人QQ 545718303. 求大神回答.定当感谢.

html5-【菜鸟问题】两组轮播JS代码有冲突,问题很多!求高手帮忙解决

问题描述 [菜鸟问题]两组轮播JS代码有冲突,问题很多!求高手帮忙解决 上图JS代码如下: [code=javascript] //首页顶部轮播 var i = 0; jummper(); function jummper() { $(".car ul li").eq(i).find("img").css("left", "-100%"); //滑动图在左边-100%准备 $(".car ul li").e

日历-两个js代码放在一个页面中冲突

问题描述 两个js代码放在一个页面中冲突 <script> $.fn.smartFloat = function() { var position = function(element) { var top = element.position().top, pos = element.css("position"); $(window).scroll(function() { var scrolls = $(this).scrollTop(); if (scrolls &

请教复制页面地址到剪切板的js代码

问题描述 很多网站里有"推荐给朋友"的功能,就是把点击一下能够当前页面路径复制一下,然后可以粘贴,请问这个js代码是什么?要求同时兼容遨游浏览器. 解决方案 解决方案二:http://blog.sina.com.cn/s/blog_4bed0b5e0100mz5m.html解决方案三:1.复制专题地址和url地址<inputtype="button"name="anniu1"onClick='copyToClipBoard()'value=

最佳JS代码编写的14条技巧_javascript技巧

写任何编程代码,不同的开发者都会有不同的见解.但参考一下总是好的,下面是来自Javascript Toolbox发布的14条最佳JS代码编写技巧. 1. 总是使用 var 在javascript中,变量不是全局范围的就是函数范围的,使用var关键词将是保持变量简洁明了的关键.当声明一个或者是全局或者是函数级(function-level)的变量,需总是前置var关键词,下面的例子将强调不这样做潜在的问题. 不使用 Var 造成的问题 var i=0; // This is good - crea

解释一段在光标位置插入字符的js代码

js|插入|光标 这篇小文本来应该在昨天发的,但是由于我昨天敲错了一个键(就是IBM笔记本键盘上的前进后退),导致文章丢失...今天就简写了.网络上有许多能在光标位置插入字符的js代码,比较啰嗦,不适合讲解.我写了一段简单的代码,解释一下: 1234567 <FORM> <TEXTAREA NAME="a" ONSELECT="this.pos=document.selection.createRange();"  onKEYUP="th