Javascript jQuery菜单工作不正常
我正在尝试让jQuery菜单运行,它悬停在每个项目上。这是你的电话号码。你可能会在结果中看到什么。当我悬停一个项目时,所有项目都会受到影响。我的错在哪里 下面是javascript代码:Javascript jQuery菜单工作不正常,javascript,jquery,css,drop-down-menu,Javascript,Jquery,Css,Drop Down Menu,我正在尝试让jQuery菜单运行,它悬停在每个项目上。这是你的电话号码。你可能会在结果中看到什么。当我悬停一个项目时,所有项目都会受到影响。我的错在哪里 下面是javascript代码: $(document).ready(function(){ //Remove outline from links $("a").click(function(){ $(this).blur(); }); //When mouse rolls over
$(document).ready(function(){
//Remove outline from links
$("a").click(function(){
$(this).blur();
});
//When mouse rolls over
$("li").mouseover(function(){
$(this).stop().animate({height:'200px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});
//When mouse is removed
$("li").mouseout(function(){
$(this).stop().animate({height:'140px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});
});
如果其余部分也是必要的,请查看打开时需要设置负上边距。尽管这可能会证明lis的浮动存在问题
//When mouse rolls over
$("li").mouseover(function(){
$(this).stop().animate({'height':'200px','margin-top':'-60px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});
//When mouse is removed
$("li").mouseout(function(){
$(this).stop().animate({'height':'140px','margin-top':'0px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});
这是关于CSS的。“li”越大,你的“ul”越大。试试这个:
$(document).ready(function(){
//Remove outline from links
$("a").click(function(){
$(this).blur();
});
//When mouse rolls over
$("li").mouseover(function(){
$(this).stop().animate({marginTop:'-60px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});
//When mouse is removed
$("li").mouseout(function(){
$(this).stop().animate({marginTop:'0px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});
});