如何获得jQuery-UI版本? [英] How do I get the jQuery-UI version?

查看:107
本文介绍了如何获得jQuery-UI版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这应该是一个简单的问题,但是如何检测jQuery-UI版本?

This should be an easy question, but how do I detect the jQuery-UI version?

这是针对Greasemonkey脚本的,并且(当前)目标页面似乎正在运行jQuery-UI 1.5.2.但是,不同的目标页面可能运行不同的版本.

This is for a Greasemonkey script and the (current) target page appears to be running jQuery-UI, 1.5.2. But, different target pages may run different versions.

console.log ($.ui);对于版本检测未显示任何有用/明显的内容.

console.log ($.ui); did not show anything useful/obvious for version detection.

推荐答案

您可以使用

You can use $.ui.version, it's actually the property jQuery UI looks for when determining if it should load itself (if it's already there, abort).

例如此处是一个小提琴,其中包括版本1.8.4 .

不幸的是,在jQuery-UI 1.6版中添加了$.ui.version.

Unfortunately, $.ui.version was added in jQuery-UI version 1.6.

对于早期版本,您可以检查$.ui.

For earlier versions, you can check for $.ui though.

因此,在这种情况下,以下内容可能就足够了:

So, in this case, the following might be good enough:

var version = $.ui ? $.ui.version || "pre 1.6" : 'jQuery-UI not detected';

这篇关于如何获得jQuery-UI版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆