如何在 jquery mobile 和 jquery 中解决 jquery 冲突



我正在做一个在移动设备上查看的网站,并使用移动css和jquery来制作效果。

<link rel="stylesheet" href="<?=base_url()?>css/jquery_01.css" /> 
 <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0-rc.2/jquery.mobile-1.1.0-rc.2.min.js"></script>

在我的网站上,我有一部分用于绘图,所以我使用了jquery

http://slot.pixelass.com/

但是当我包含上述移动 jquery 时,用于绘图的 jquery 将不起作用。我不知道how to tackle jquery conflict.

请有人帮忙,任何帮助都会被接受。提前致谢

有一个名为 jQuery.noConflict() 的特定 jQuery 函数来帮助消除与其他库的任何冲突。以下是jQuery文档中的一个片段:

<script type="text/javascript">
  // This takes out the jQuery variable '$' from the global scope
  $.noConflict();
  jQuery(document).ready(function($) {
    // Code that uses jQuery's $ can follow here.
  });
  // Code that uses other library's $ can follow here.
</script>

最新更新