i have a service i'm building, which will be included as JS on client web pages. optimally, i want to build the service using jquery.
我有一个我正在构建的服务,它将作为JS包含在客户端网页上。最理想的是,我想使用jquery构建服务。
the case may arise, where the page already has JQ included.
可能出现这种情况,其中页面已经包含JQ。
how do i avoid including JQ twice in the page? how do i make sure i still have the desired JQ functionality, even if the page has already included an older version of JQ?
我如何避免在页面中包含两次JQ?我如何确保我仍然拥有所需的JQ功能,即使页面已经包含旧版本的JQ?
is the only solution simply abandoning JQ and going with hand-coded script?
是唯一一个简单地放弃JQ并使用手工编写脚本的解决方案?
2 个解决方案
#1
5
Check for the existence of jQuery
and match the version you need against jQuery.fn.jquery
.
检查是否存在jQuery并匹配jQuery.fn.jquery所需的版本。
#2
0
from the linkedin jquery group:
来自linkedin jquery组:
Ever want to use the latest jQuery, but old code or components leaves you with an older version? Well this standalone version can be included anywhere on the page and will take a custom name space of jQuery14, and will not affect jQuery or $ in any way. Also, easy way to integrate among other frameworks.
曾经想使用最新的jQuery,但是旧的代码或组件会让您使用旧版本?那么这个独立版本可以包含在页面的任何地方,并且将采用jQuery14的自定义名称空间,并且不会以任何方式影响jQuery或$。此外,还可以轻松地集成到其他框架中。
http://www.matthewdunham.com/jquery-1.4.2.min.standalone.js
http://www.matthewdunham.com/jquery-1.4.2.min.standalone.js
#1
5
Check for the existence of jQuery
and match the version you need against jQuery.fn.jquery
.
检查是否存在jQuery并匹配jQuery.fn.jquery所需的版本。
#2
0
from the linkedin jquery group:
来自linkedin jquery组:
Ever want to use the latest jQuery, but old code or components leaves you with an older version? Well this standalone version can be included anywhere on the page and will take a custom name space of jQuery14, and will not affect jQuery or $ in any way. Also, easy way to integrate among other frameworks.
曾经想使用最新的jQuery,但是旧的代码或组件会让您使用旧版本?那么这个独立版本可以包含在页面的任何地方,并且将采用jQuery14的自定义名称空间,并且不会以任何方式影响jQuery或$。此外,还可以轻松地集成到其他框架中。
http://www.matthewdunham.com/jquery-1.4.2.min.standalone.js
http://www.matthewdunham.com/jquery-1.4.2.min.standalone.js