首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jQuery动画()脉冲()不工作

问jQuery动画()脉冲()不工作
EN

Stack Overflow用户
提问于 2012-04-07 04:26:19
回答 1查看 1.4K关注 0票数 0

在下面的代码中,click()中的animate()函数起作用。但是,mouseenter()中的animate()或pulse() (未注释时)也不起作用。pulse()函数是由Jarrod提供的。

http://jarrodoverson.com/static/demos/jquery.pulse.html

代码语言:javascript
复制
    sectionTitle = $j(this).find(".sectionTitle");
    sectionTitle.click(function(){
    if($j(this).parent().height() == sections[$j(this).parent().attr("id")]["height"]){
        origHeight = sections[$j(this).parent().attr("id")]["origHeight"];
        $j(this).parent().animate({height:origHeight},"slow");
    }else{
        height = sections[$j(this).parent().attr("id")]["height"];
        $j(this).parent().animate({height:height},"slow");
    }
    })
    sectionTitle.mouseenter(function(){
    var properties = { "color" : '#F00' };
  //    $j(this).pulse(properties, 500, 3);
    $j(this).animate({"background-color":'#F00'},"slow");
    })

下面是我的代码的一个活生生的例子。http://fantasticvisions.net/test/me/

上面页面上的许多H2元素都应用了classs sectionTitle。单击它们将使用jQuery animate()展开内容。但是,mouseenter()失败。

这里我漏掉了什么?我已经尝试了许多其他的变体,但都不起作用。mouseenter()事件确实会触发,并执行代码(我已经跟踪到了这一点),但效果似乎从未发生过。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-04-07 04:55:43

.animate()不工作,因为jQuery本身不支持颜色动画。

如果你包含jQuery UI或者一个彩色动画插件,这应该是可行的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10048867

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档