通常のマウス脱退機能は完全に機能していますが、マウスを非常にゆっくりと離すと、マウスアウト機能が機能しません。
var timeoutId;
$('.box').mouseover(function(){
var $this=$(this);
if (!timeoutId) {
timeoutId = window.setTimeout(function() {
timeoutId = null;
$this.animate({
marginTop:'-224px',
height:'300px'
})
$this.find('.rotate-arrow').addClass('rotate');
$this.find('.header-content-span').css('display','none');
},1000); }
});
$('.box').mouseleave(function(){
var $this=$(this);
if (timeoutId) {
window.clearTimeout(timeoutId);
timeoutId = null;
$this.animate({
marginTop:'0px',
height:'77px'
})
$this.find('.rotate-arrow').removeClass('rotate');
$this.find('.header-content-span').css('display','block');
}