js $冲突,求解决
function $(obj){ //alert(obj);
return typeof(obj) == "string" ? document.getElementById(obj) : obj;
}
//上面的JS和下面的JS有冲突,主要是$重复使用,改下面的JS应怎样改呢,请都大家了!
var litbNavWith=952;
$('#litb-nav>li').each(function(){litbNavWith-=$(this).width();
var p=$(this),a=p.children('a'),b=a.parent().find('div'),t;
if(b){p.hover(function(){clearTimeout(t);
t=setTimeout(function(){a.addClass('current');
p.addClass('current');
b.show()},150)},function(){clearTimeout(t);
t=setTimeout(function(){a.removeClass('current');
p.removeClass('current');
b.hide()},150)})}});
$('#allCategory').width(litbNavWith);
if($.browser.msie&&$.browser.version<7){$('#allCategory dd,.sub-nav-container').bgiframe()};
$('.alignCenter').each(function(){var w=$(this).width()-$(this).parent().width();
$(this).css('left',-w/2)});
$('#viewAllCateIcon').bind('click',function(){$(this).blur();
$('#allCategory dd').toggle()});
$('#viewAllCateText').bind('mouseover',function(){$('#allCategory dd').fadeIn('fast')});$(document).bind('click', function (e) {try {var obj = e.target;
if (obj.id == 'allCategory')
return;
var closeable = true;
while (obj.tagName != 'BODY') {obj = obj.parentNode;
if (obj.id == 'allCategory') closeable = false;}if (closeable)
$('#allCategory dd').fadeOut('fast');} catch (err) {$('#allCategory dd').fadeOut('fast');}});
$('#curSelector, #langSelector, #UAP-help>dl,#UAP-orders>dl, #UAP-livechat>dl').hover(function(){$(this).addClass('over')},
function(){$(this).removeClass('over')});
...全文
相关推荐
jQuery与其他JS库或jQuery文件冲突解决方法
"jQuery与其他JS库或jQuery文件冲突解决方法"在Web开发中,尤其是在使用JavaScript库时,可能会遇到库与库之间的冲突问题,特别是当同时使用jQuery和其他使用$符号作为主
jQuery解决$符号命名冲突
但当页面中引入了其他JavaScript库,比如prototype.js,而这个库同样使用$作为其函数或对象的简写,就会产生命名冲突。
jQuery多个版本和其他js库冲突的解决方法
同一页面上jQuery与其他js库冲突的解决: 当其他库(如Prototype)也使用`$`时,你可以使用`noConflict()`方法释放`$`,让其他库接管它。
如何解决jQuery 和其他JS库的冲突
特别是一些流行的JavaScript库,例如Prototype.js、MooTools或YUI,它们往往也有自己使用的全局变量(例如$符号),这与jQuery默认使用的$符号是冲突的。
jQuery中 $ 符号的冲突问题及解决方案
然而,当一个页面中同时引用了多个版本的jQuery或者其他使用了`$`作为主要函数的JavaScript库时,就会出现冲突问题。本文将深入探讨这个问题,并提供解决方案。


基础编程
