【问题标题】:jquery mouseover animationjquery 鼠标悬停动画
【发布时间】:2012-02-23 17:42:12
【问题描述】:

我在使用切换时可以正常工作,但我需要在鼠标悬停而不是单击时打开这些菜单。

有问题的页面: http://igs.link-networkonline.com/campaign-landing-page/

我的代码:

$(function() {
$("img.button1").toggle(function() {
    $(".first").animate({'height': '295px', 'top': "-270px"});
    $("img.button1").animate({'top': "-235px"});
    $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
    $("body").animate({'padding-bottom': '-300px'});
}, function() {
    $(".first").animate({'height': '75px', 'top': "-58px", 'overflow': "hidden"});
    $("img.button1").animate({'top': "-25px"});
    $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
});
   $("img.button2").toggle(function() {
        $(".second").animate({'height': '285px', 'top': "-268px"});
        $("img.button2").animate({'top': "-240px"});
        $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
    }, function() {
        $(".second").animate({'height': '75px', 'top': "-58px"});
        $("img.button2").animate({'top': "-25px"});
        $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
    });
$("img.button3").toggle(function() {
    $(".third").animate({'height': '260px', 'top': "-243px"});
    $("img.button3").animate({'top': "-210px"});
    $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
}, function() {
    $(".third").animate({'height': '75px', 'top': "-58px"});
    $("img.button3").animate({'top': "-25px"});
    $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
});

$(".first").toggle(function() {
    $(".first").animate({'height': '295px', 'top': "-270px"});
    $("img.button1").animate({'top': "-235px"});
    $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
    $("body").animate({'padding-bottom': '-300px'});
}, function() {
    $(".first").animate({'height': '75px', 'top': "-58px", 'overflow': "hidden"});
    $("img.button1").animate({'top': "-25px"});
    $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
});
   $(".second").toggle(function() {
        $(".second").animate({'height': '285px', 'top': "-268px"});
        $("img.button2").animate({'top': "-240px"});
        $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
    }, function() {
        $(".second").animate({'height': '75px', 'top': "-58px"});
        $("img.button2").animate({'top': "-25px"});
        $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
    });
    $(".third").toggle(function() {
        $(".third").animate({'height': '260px', 'top': "-243px"});
        $("img.button3").animate({'top': "-210px"});
        $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
    }, function() {
        $(".third").animate({'height': '75px', 'top': "-58px"});
        $("img.button3").animate({'top': "-25px"});
        $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
    });

}); 

这已经花了我很多时间才能正常运行。我需要每个在鼠标悬停时向上滑动并在鼠标悬停时向下滑动。谢谢你。 }); `

【问题讨论】:

  • 我猜你想让我们为你做这件事?到目前为止,您尝试过什么?
  • 我尝试过使用 hover(function() 但是当我实现它时,菜单会继续上下滑动。它上面的链接会更新以显示错误。
  • 这已经解决了,我有一些冲突的js

标签: jquery jquery-animate mouseover slide


【解决方案1】:

你可以使用 .mouseover() & .mouseout() 事件来处理它。

【讨论】:

    猜你喜欢
    • 2012-03-31
    • 1970-01-01
    • 2012-05-04
    • 1970-01-01
    • 1970-01-01
    • 2012-08-11
    • 1970-01-01
    • 2012-07-22
    • 2011-08-04
    相关资源
    最近更新 更多