js $冲突,求解决

brilliant_fgh 2011-09-09 04:16:31
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')});
...全文
72 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lisi13120 2011-09-09
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 jordan102 的回复:]

在下面前面加上:
var jq=jQuery.noConflict();
下面的$全部改为jq
[/Quote]

同意楼上
一起混吧 2011-09-09
  • 打赏
  • 举报
回复
在下面前面加上:
var jq=jQuery.noConflict();
下面的$全部改为jq

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧