jQuery UI Touch库是否有别名



我看到jQuery UI Touch Puch的开始行是这样的:

(function ($) {
    // Detect touch support
    $.support.touch = 'ontouchend' in document;

最后一行是:

})(jQuery);

这是否意味着这个代码中的美元符号是别名?我们遇到了在同一页面上运行不同版本的jQuery的问题(Adobe Edge动画需要旧版本,而我们的应用程序从新版本进行最新/最大的拖放)。我们想开始将我们的代码别名为不同的变量,并希望确保我们涵盖了所有版本。这个库已经别名了吗?

(function (jQ) {     // this is a reference to jQuery, see last line
  // Detect touch support
  jQ.support.touch = 'ontouchend' in document;// but than use your reference inside your fn
})(jQuery);

或使用jQuery.noConflict():

jQuery.noConflict();
(function ($) {     // remap '$' to 'jQuery' (see last line)
  // Detect touch support
  $.support.touch = 'ontouchend' in document;// use '$' freely
})(jQuery);

最新更新