slideUp()如果我使用的初始选择器包含,我如何向函数添加回调函数children()?
$('.homebuttonbutton').hover(function() {
$(this).stop().children('.homebuttonaction').slideDown();
$(this).children('.homebuttonlabel').addClass('whitebutton');
}, function() {
$(this).stop().children('.homebuttonaction').slideUp(300, function() {
$(this).children('.homebuttonlabel').removeClass('whitebutton');
});
//$(this).children('.homebuttonlabel').removeClass('whitebutton');
});
所以理想情况下,当悬停时,孩子.homebuttonaction向下滑动并.whitebutton添加类,然后当未悬停时,.homebuttonaction向上滑动并.whitebutton删除类。
我希望在slideUp动画完成后删除该类,但我不确定如何“选择”它,因为初始选择器children用于回调函数。
会有多个.homebuttonaction类,所以我不能只使用
$('.homebuttonaction').removeClass('.whitebutton');
因为那样它将适用于每个人,对吗?回调函数是否$(this)首先将其视为被选中的项目,还是将其视为通过 找到的当前选定项目children()?
谢谢你的帮助,所以。
编辑 这是我的小提琴 - http://jsfiddle.net/kcxWc/ - 如您所见,该类没有被删除,因为它应该在 slideUp 效果结束之后。我相信这是一个选择器问题......