两个JS,网页导航栏和图片切换冲突,导航栏用Jquery 是不是因为函数名$ 冲突 怎么改?

图片切换部分JS代码:varisIE=(document.all)?true:false;var$=function(id){return"string"==typeof... 图片切换部分JS代码:
var isIE = (document.all) ? true : false;
var $ = function (id) {
return "string" == typeof id ? document.getElementById(id) : id;
};
var Class = {
create: function() {
return function() { this.initialize.apply(this, arguments); }
}
}
var Extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
}
var Bind = function(object, fun) {
return function() {
return fun.apply(object, arguments);
}
}

var Each = function(list, fun){
for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); }
};

var RevealTrans = Class.create();
RevealTrans.prototype = {
initialize: function(container, options) {
this._img = document.createElement("img");
this._a = document.createElement("a");

this._timer = null;//计时器
this.Index = 0;//显示索引
this._onIndex = -1;//当前索引

this.SetOptions(options);

this.Auto = !!this.options.Auto;
this.Pause = Math.abs(this.options.Pause);
this.Duration = Math.abs(this.options.Duration);
this.Transition = parseInt(this.options.Transition);
this.List = this.options.List;
this.onShow = this.options.onShow;

//初始化显示区域
this._img.style.visibility = "hidden";//第一次变换时不显示红x图
this._img.style.width = this._img.style.height = "100%"; this._img.style.border = 0;
this._img.onmouseover = Bind(this, this.Stop);
this._img.onmouseout = Bind(this, this.Start);
isIE && (this._img.style.filter = "revealTrans()");

this._a.target = "_blank";

$(container).appendChild(this._a).appendChild(this._img);
},

};
展开
 我来答
sunfan1010
推荐于2016-01-17 · 超过14用户采纳过TA的回答
知道答主
回答量:49
采纳率:0%
帮助的人:39.4万
展开全部
是定义的$冲突引起

var $ = function (id) {
return "string" == typeof id ? document.getElementById(id) : id;
};

$改为 MContain

var MContain = function (id) {
return "string" == typeof id ? document.getElementById(id) : id;
};

$(container).appendChild(this._a).appendChild(this._img);

改为

MContain(container).appendChild(this._a).appendChild(this._img);
追问
改了后导航栏正常了,但是图片切换还是不能实现,要不你给我邮箱 我把文件发给你  你帮我看看
追答
12179110#qq.com
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
一瞥不够
2014-06-20 · TA获得超过905个赞
知道小有建树答主
回答量:760
采纳率:71%
帮助的人:218万
展开全部
将导航栏代码里的$都换成jQuery。或者给放到一个命名空间里。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友2b0f2ca
2014-06-20 · 超过11用户采纳过TA的回答
知道答主
回答量:46
采纳率:0%
帮助的人:28.5万
展开全部
你可以把所有的“$”换成“jQuery”试试
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式