jQuery技术

How to include js file in a module which depend on jquery?

字号+ 作者:H5之家 来源:H5之家 2017-05-15 12:02 我要评论( )

猪跑啦(Drupalla)聚合国内优秀的Drupal 开发者,快速入门Drupal模块、Drupal主题开发,Drupal技术人员一起打造一个有价值的Drupal社区。

I actually think it is pretty unlikely that you have a weight problem, unless you redefined your module to have a extremely low weight. Make sure you have JS optimization turned off, and then do a view source and make sure jQuery is the first script loaded (nearly always is).

My two guesses are

You have a JS error somewhere else, and this is a weird side effect.

You have a JS error in your catalog_menu.js (or another file) that is nuking the $ object by accident.

Also, you should you use JS module pattern for code, because Drupa 7 defaults jQuery no-conflict mode.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 $init $.Drupal.attach: init jQuery

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • Drupal中国

    Drupal中国

    2015-11-17 13:13

网友点评