当前位置: 代码迷 >> Java Web开发 >> jquery脚本冲突怎么解决
  详细解决方案

jquery脚本冲突怎么解决

热度:73   发布时间:2016-04-16 22:20:43.0
jquery脚本冲突如何解决?
有两个脚本:
第一个:控制图片自动显示
 <script type="text/javascript">
                //  添加方法
                $(".js_banner").addBanner({
                    effect : "order",
                    selectedClass : "on",
                    returnFirstClass:".js_banner_warp  .sp_first",
                    returnLastClass:".js_banner_warp .sp_last",
                    arrivePreviousClass:".js_banner_warp  .sp_pre",
                    arriveNextClass:".js_banner_warp   .sp_next",
                    mouseType:"click",
                    tweenTime : 600,
                    delay:6000,
                    autoPlay : true
                });
                //  控制上一个下一个的显示情况
                $(".js_banner_warp").hover(function(){
                    $(this).find(".sp_next , .sp_pre " ).fadeIn("fast");
                },function(){
                    $(this).find(".sp_next , .sp_pre " ).fadeOut("slow");
                })
                </script>
第二个有登陆有关的验证:
(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){validator.settings.submitHandler.call(validator,validator.currentForm);return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=false;var validator=$(this[0].form).validate();this.each(function(){valid|=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}...........}})})(jQuery);
这两个脚本单独都运行正常但放到一块九有脚本错误,如何解决呢?
------解决方案--------------------
没看出什么问题,这两个都是基于jquery的脚本,没有看到有冲突的地方。
  相关解决方案