js $冲突,求解决

brilliant_fgh brilliant_fgh 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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')});
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
brilliant_fgh
基础编程 21,889 成员 140,329 内容