単純divに、ボタンをクリックするとアニメーション化され、別のボタンをクリックすると非表示になるはずのがあります。
<div id="popup"></div>
<input type="button" value="show and animate popup" onClick="showWithAnimation()" />
<input type="button" value="hide" onClick="aFunction()" />
<script>
function showWithAnimation(){
console.log('animation called');
$('#popup') .animate({top:(($(window).height()/2)-($('#popup').outerHeight()/2))-70}, 1000, 'easeOutBounce');
$('#popup').show();
}
function aFunction(){//Hide the div
$('#popup').hide();
}
</script>
私が気付いたのは、バウンス効果がdiv最初にクリックしたときにのみ適用されshow and animate popup、次にhideボタンをクリックしてからもう一度show and animate popupボタンをクリックすると、divが表示されますが、easeOutBounce効果はありません。それを解決する方法を教えてもらえますか?よろしくお願いします。