在webOS上使用PhoneGap的jQTouch

Ste*_*Nay 1 jquery webos jqtouch cordova

我正在写PhoneGap的应用程序,我想在iOS,Android和webOS上运行.jQTouch适用于iOS和Android上的所有内容,但不适用于webOS.

由于webOS Mojo框架基于Prototype(使用$变量),因此必须在noConflict模式下使用jQuery.我可以处理那么多.

但问题是我还想使用jQTouch插件.该jqtouch.js文件$始终使用,导致加载该文件时出现JavaScript错误.

有没有办法在我的PhoneGap应用程序中运行jQTouch插件(或任何插件)而不会干扰Prototype?

Jes*_*ris 6

你应该能够将它包装在一个闭包中并传递jQuery.例如:

(function($){
   alert($);
}("Hello"))

(function($){
   $("foo"); // uses the jQuery rather than $
}(jQuery))
Run Code Online (Sandbox Code Playgroud)