在Drupal 7中使用jQuery和CSS“Zen”主题 [英] Using jQuery with CSS in Drupal 7 "Zen" theme

查看:203
本文介绍了在Drupal 7中使用jQuery和CSS“Zen”主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编辑Drupal 7中的Zen主题。这是问题:

  Drupal,window,document,undefined){
alert(xuy);
$(#navigation ul.links li)。hover(function(){
alert );
});

第一个警报工作正常,但没有即使

  $(a)hover {
alert(xuy);
});



<


b b b pre> (function($){
Drupal.behaviors.mybehavior = {
attach:function(context,settings){
//这里
// $将在此函数内工作
}
};
})(jQuery);


I'm editing the "Zen" theme in Drupal 7. And that's the problem:

 (function ($, Drupal, window, document, undefined) {        
         alert("xuy");
         $("#navigation ul.links li").hover(function() {
         alert("xuy");
    });

The first alert is working well, but there is no alert on hover. I've got this class in CSS. Even

 $("a").hover(function() { 
          alert("xuy"); 
    });

Didn't work.

解决方案

you should determine $ like

(function($) {
  Drupal.behaviors.mybehavior = {
    attach: function(context, settings){
       //you code goes here
       //$ will work inside this function
    }
  };
})(jQuery);

这篇关于在Drupal 7中使用jQuery和CSS“Zen”主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆