1
我有一个购买主题的Drupal网站 - see it here。主题中包含jQuery和Bootstrap,但无法使用
主题包括页面<head>
部分的jQuery 2.x和引导,但在尝试访问该$
变量提供Uncaught TypeError: $ is not a function
我有一个购买主题的Drupal网站 - see it here。主题中包含jQuery和Bootstrap,但无法使用
主题包括页面<head>
部分的jQuery 2.x和引导,但在尝试访问该$
变量提供Uncaught TypeError: $ is not a function
的Drupal商店的jQuery在一个叫jQuery
(使用jQuery的noConflict
模式变量 - 见drupal.js
)而不是$
,以避免与Prototype等其他库冲突。
// Allow other JavaScript libraries to use $.
jQuery.noConflict();
你可以这样做:
jQuery(document).ready(function($){
// normal jQuery stuff here
$.whatever
});
感谢您的例子!我担心我不得不改变每一行:D –