使用 jQuery.support = false

发布于 2024-08-15 13:01:43 字数 382 浏览 6 评论 0原文

因此,我最近想使用 jQuery 进行一些浏览器检测,并注意到从 jQuery 1.3 开始,以前的方法目前已被弃用。

他们现在建议不要测试浏览器,而是测试浏览器的功能。听起来是个好主意,但我不知道如何实际利用这个想法。

$("p").html("This frame uses the W3C box model: <span>" +
            jQuery.support.boxModel + "</span>");

这很棒,但是我如何将其包装成:

If jQuery.support.boxModel = false then

有什么想法吗?节日快乐!

So I recently wanted to use the jQuery to do some browser detection and noticed that the previous methods were currently deprecated as of jQuery 1.3.

They now recommend that instead of testing for a browser, test for the features of the browser. Sounds like a good idea, but I cant figure out how to actually utilize this idea.

$("p").html("This frame uses the W3C box model: <span>" +
            jQuery.support.boxModel + "</span>");

This is great and all, but how would I wrap that into something that was:

If jQuery.support.boxModel = false then

Any Ideas? Happy Holidays!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倥絔 2024-08-22 13:01:43
if(! jQuery.support.boxModel) {
    //do stuff
}
if(! jQuery.support.boxModel) {
    //do stuff
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文