下面的代码给我带来了很多麻烦。需要注意的是, .hover 会更改背景图像。首先,如何将两者与 .hover 结合,而不是单独的 mouseenter 和 mouseleave?其次,我怎样才能使 div 向上移动时,背景图像同时褪色?
$('div.designbox.orangehello').mouseenter(function() {
$('div.designbox.orangehello').animate({
top: '-=10',
}, 55, function() {
$(this).addClass('hover');
});
});
$('div.designbox.orangehello').mouseleave(function() {
$('div.designbox.orangehello').animate({
top: '+=10',
}, 55, function() {
$(this).removeClass('hover');
});
});