私は2つの別々のアニメーションを実行しています。1つはでもう1つは発火しmouseenter
ますclick
。問題は、両方をアクティブにすると、ジャンプするアニメーションが作成されることです。
あなたは私がここで意味することを見ることができます:JSFiddle
イベントがアクティブ化されmouseenter
た場合、イベントの発生を防ぐことはできますか?click
Javascript
$('header h1').mouseenter(function() {
$('header:not(.open)').delay(500).animate({
'padding-bottom': '40px'
}, 150, function() {
//function complete
});
});
$('header h1').mouseleave(function() {
$('header:not(.open)').animate({
'padding-bottom': '20px'
}, 150, function() {
//function complete
});
});
$('header h1').click(function() {
if ($('header').hasClass('open')) {
$('header p').fadeOut(100);
$('header').removeClass('open').animate({
'padding-bottom': '20px'
}, 300, function() {
//animation complete
});
}
else {
$('header').addClass('open').animate({
'padding-bottom': '150px'
}, 300, function() {
$('header p').fadeIn();
});
}
});