如果检测到internet explorer,则运行javascript
我有以下代码:如果检测到internet explorer,则运行javascript,javascript,jquery,qtip2,Javascript,Jquery,Qtip2,我有以下代码: $(document).ready(function () { $('body a[href]').qtip({ hide: { fixed: true, delay: 500 }, style: { classes: 'qtip-dark qtip-shadow' }, position: { v
$(document).ready(function () {
$('body a[href]').qtip({
hide: {
fixed: true,
delay: 500
},
style: {
classes: 'qtip-dark qtip-shadow'
},
position: {
viewport: $(window)
}
});
jQuery.each(jQuery.browser, function (i, val) {
$("<div>" + i + " : <span>" + val + "</span>")
.appendTo(document.body);
});
});
使用
它们也是高度可定制的--使用
它们也是高度可定制的--您可以使用javascript代码来检测
//Test for Internet Explorer
if (/MSIE\s([\d.]+)/.test(navigator.userAgent)) {
//Get the IE version. This will be 6 for IE6, 7 for IE7, etc...
version = new Number(RegExp.$1);
}
您可以使用javascript代码来检测
//Test for Internet Explorer
if (/MSIE\s([\d.]+)/.test(navigator.userAgent)) {
//Get the IE version. This will be 6 for IE6, 7 for IE7, etc...
version = new Number(RegExp.$1);
}
请注意,浏览器检查是次优的。。API也指出了这一点:Description:包含useragent的标志,从navigator.useragent读取。我们建议不要使用此属性;请尝试改用功能检测(请参阅jQuery.support)。jQuery.browser可能会在jQuery的未来版本中被移动到插件中。@Sirko--jQuery.browser的副本已被弃用,并且在1.9中被完全删除。我没有看到该副本,对于像我这样的人来说,对jQuery非常陌生,等等。。这似乎无助于解决我的具体问题。如果我也将这些新内容复制到StackOverflow,我深表歉意。我应该删除这篇文章吗?请注意,浏览器检查不是最理想的。。API也指出了这一点:Description:包含useragent的标志,从navigator.useragent读取。我们建议不要使用此属性;请尝试改用功能检测(请参阅jQuery.support)。jQuery.browser可能会在jQuery的未来版本中被移动到插件中。@Sirko--jQuery.browser的副本已被弃用,并且在1.9中被完全删除。我没有看到该副本,对于像我这样的人来说,对jQuery非常陌生,等等。。这似乎无助于解决我的具体问题。如果我也将这些新内容复制到StackOverflow,我深表歉意。我应该删除这篇文章吗?jQuery.browser不推荐使用,因为jQuery v1.3。并且在v1.9中被完全删除。jQuery.browser自jQuery v1.3以来已被弃用。并已在v1.9中完全删除。感谢您的帮助和链接!我将切换到功能检测。感谢您的帮助和链接!我将切换到功能检测。
//Test for Internet Explorer
if (/MSIE\s([\d.]+)/.test(navigator.userAgent)) {
//Get the IE version. This will be 6 for IE6, 7 for IE7, etc...
version = new Number(RegExp.$1);
}