这里是我的地盘:的jQuery/CSS不选择,和stop()问题
将鼠标移到菜单上的右侧。请注意汽车服务,拖车拖拽和显示默认情况下完全放大。这是因为他们销售的产品较高,大多数浏览本网站的人都在寻找这些产品。
目前存在使用下面的代码手风琴菜单设置:
$(function(){
$('.buttonEffectWrapper').hover (
function() {
var effect = $(this).siblings().filter(":last");
effect.stop().animate ({ opacity: 1}, { duration: 300 });
$(this).stop().parent().animate({height: "110px"}, {duration: 300 });//accordion effect here
},
function() {
var effect = $(this).siblings().filter(":last");
effect.stop().animate ({ opacity: 0}, { duration: 300 });
$(this).stop().parent().animate({height: "30px"}, {duration: 300 });//accordion effect here
}
);
});
首先,如果你在按钮上几次的一个水平移动鼠标,它建立了一个队列。我认为使用stop()应该可以解决这个问题,但它似乎不是。其次,我不希望前三个div(#car-service,#trailer-hauling和#display-and-show)在鼠标离开时折叠。我尝试了以下,但它选择一切其他。
$(this + ":not(#car-service, #trailer-hauling, #display-and-show)").stop().parent().animate({height: "30px"}, {duration: 300 });
;第三,如果你将鼠标放置一个DIV,然后移动到一个它下面,作为一个DIV扩大和其他倒塌,你的鼠标,你不会打算的位置结束。我能想到解决这个问题的唯一方法是不允许以前的div崩溃。
所以,如果我溺爱#car-service
,然后去#trailer-hauling
,#car-service
不应该崩溃。但如果我从#trailer-hauling
移动到#show-and-display
,那么我想要#car-service
收缩。这应该防止界面被破坏。
代码不为我工作.. – Jared 2010-01-04 20:34:53
@Jared,搞砸了动画功能。还采取了@戴维的队列问题的建议。现在已经修复了。它为你做了什么? – munch 2010-01-04 20:47:13
我看到......它的地址(this),而它实际上需要看父母的div。如果(!$ this).parent()。是有效的。 – Jared 2010-01-04 20:51:29