Javascript Jquery滑出菜单项

Javascript Jquery滑出菜单项,javascript,jquery,html,css,animation,Javascript,Jquery,Html,Css,Animation,我已经搜索了一个又一个Jquery的选项,我似乎找不到任何我想要的东西,但它似乎是如此简单的效果。有谁能告诉我,当有人将鼠标悬停在下图中的菜单项上时,如何使其像第二项一样滑出 $('.menuClass').mouseover(function(){ $(this).animate({'marginTop':'100px'}); }); $('.menuClass').mouseout(function(){ $(this).animate({'marginTop':'0px'

我已经搜索了一个又一个Jquery的选项,我似乎找不到任何我想要的东西,但它似乎是如此简单的效果。有谁能告诉我,当有人将鼠标悬停在下图中的菜单项上时,如何使其像第二项一样滑出

$('.menuClass').mouseover(function(){
    $(this).animate({'marginTop':'100px'});
});

$('.menuClass').mouseout(function(){
    $(this).animate({'marginTop':'0px'});
});

相应地更改marginTop的值

这些措施也将有助于:

相应地更改marginTop的值

这些措施也将有助于:


您可以为此使用多个css动画方法

jQuery:

$('div').bind({
  mouseenter: function() {
    $(this).stop().animate({'background-position-y':'-20px','height':'68px'},600);
  },
  mouseleave: function() {
    $(this).stop().animate({'background-position-y':'-58px','height':'30px'},600);
  }
});​
css:

---------------------------------- 或

您只需使用CSS3即可做到这一点:


您可以为此使用多个css动画方法

jQuery:

$('div').bind({
  mouseenter: function() {
    $(this).stop().animate({'background-position-y':'-20px','height':'68px'},600);
  },
  mouseleave: function() {
    $(this).stop().animate({'background-position-y':'-58px','height':'30px'},600);
  }
});​
css:

---------------------------------- 或

您只需使用CSS3即可做到这一点:


可以使用动画jquery方法:


可以使用动画jquery方法:


非常感谢你!这真的很有帮助。我是个初学者,这东西可能很复杂。。。特别是当你不知道自己在做什么的时候。非常感谢你!这真的很有帮助。我是个初学者,这东西可能很复杂。。。特别是当你不知道自己在做什么的时候。非常感谢!这真的很有帮助,正是我想要的。。我在找一个向下移动的东西,它能让我看到房间的其他部分,就像厨房的抽屉一样。。。有什么建议吗?非常感谢!这真的很有帮助,正是我想要的。。我在找一个向下移动的东西,它能让我看到房间的其他部分,就像厨房的抽屉一样。。。有什么建议吗?你看到我的asnwer伙伴了吗?我用两种方式(jQuery和css3)完全按照你的要求做了。你看到我的asnwer伙伴了吗?我用两种方式(jQuery和css3)完全按照你的要求做了
div {
    float:left; background: url(http://i.stack.imgur.com/g3aqx.jpg) -146px -58px;
    width:86px; height:30px;

transition: .5s;
-moz-transition:  .5s; /* Firefox 4 */
-webkit-transition:  .5s; /* Safari and Chrome */
-o-transition: .5s; /* Opera */
}

div:hover { background-position-y:-20px; height:68px; } ​
$("#img").hover(function() {
    $(this).stop();
    $(this).animate({top:"0"},500,null); 
}, function () {
    $(this).stop();
    $(this).animate({top:"-150"},500,null);  
});