JQuery下拉菜单<李>链接在Internet Explorer中不起作用
JQuery Dropdown Menu <li> Links Do Not Work In Internet Explorer
我最近在这个开发人员的网站上实现了一个jQuery下拉列表:http://tympanus.net/codrops/2012/10/04/custom-drop-down-list-styling/,它在我的Chrome和Firefox网站上看起来和工作都很好(我的网站是:http://www.ExpeditionerSafaris.com)。
但是,在InternetExplorer中(当然),li链接不起作用。
这是代码:
function DropDown(el) {
this.dd = el;
this.initEvents();
}
DropDown.prototype = {
initEvents: function () {
var obj = this;
obj.dd.on('click', function (event) {
$(this).toggleClass('active');
event.stopPropagation();
});
}
}
$(function () {
var dd = new DropDown($('#dd'));
$(document).click(function () {
// all dropdowns
$('.wrapper-dropdown-5').removeClass('active');
});
});
我想你有jquery confliction
参考的问题http://api.jquery.com/jQuery.noConflict/
代码有问题
$(function () {//here is problem of `$` conflictions
var dd = new DropDown($('#dd'));
$(document).click(function () {
// all dropdowns
$('.wrapper-dropdown-5').removeClass('active');
});
});
我检查了它,代码有错误
Error: TypeError: $ is not a function
Source File: http://www.expeditionersafaris.com/
Line: 426
使用jQuery(function ()
代替$(function ()
,然后尝试,或者使用jQuery.noConflict()
函数
在initEvents
方法中。不要通过event
,因为它与IE事件冲突,所以让它成为
obj.dd.on('click', function (evt) {
//evt is jQuery normalized event object
$(this).toggleClass('active');
event.stopPropagation();
});
相关文章:
- 视频HTML没有'无法在Internet Explorer 11上工作
- Internet Explorer缺少占位符支持,特别是密码字段
- Internet Explorer中的文本换行错误
- 为什么我在Internet Explorer上看不到html元素
- internet explorer 8兼容模式下的Youtube api错误
- 当浏览器控制台未打开时,为什么要求会导致Internet Explorer 9超时
- Internet Explorer 8. Events
- jQuery表单验证适用于Mozilla和Internet Explorer,但不适用于Chrome或Safari
- element.dataset in Internet Explorer
- Facebook FB.init”;访问被拒绝”;在Internet Explorer 11中
- JavaScript不适用于internet explorer和Firefox,但适用于谷歌
- 在Internet Explorer中,向所选内容添加选项不起作用
- 在Internet Explorer中从二进制文件打开PDF
- elementproblem internet explorer
- 我可以使用哪些方法在Internet Explorer中禁用Alt+*X*
- 如何在Internet Explorer中使用javascript设置cookie
- 只有当alert()在带有AJAX的internet explorer中使用时,Javascript才会更新UI
- sharepoint站点的internet explorer中出现Javascript错误
- Internet Explorer重新加载IFrame
- Internet Explorer Internet Failure HTTP Status Codes