DBr*_*558 0 javascript jquery qtip2
我有这个代码:
$(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);
});
});
Run Code Online (Sandbox Code Playgroud)
除上述代码外,如果从此浏览器功能中检测到Internet Explorer,我将如何运行脚本?如果检测到Internet Explorer,我想运行的脚本是:
$(document).ready(function () {
$('body a[href]').qtip({
hide: {
fixed: true,
delay: 500
},
style: {
classes: 'qtip-dark qtip-shadow'
}
});
Run Code Online (Sandbox Code Playgroud)
使用IE条件注释.
<!--[if IE]>
<script>
// run code here or link to external file
</script>
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
它们也是高度可定制的 - <!--[if lt IE 8]>例如,仅适用于IE 7或更低版本.开发人员使用它来为IE6/7/8创建自定义样式表.
也就是说,您应该考虑使用功能检测而不是浏览器检测来实现您想要实现的任何功能.请参阅http://modernizr.com,了解可行的最佳解决方案.