0

div の高さが変わるたびに .hover アクションを停止しようとしています。

これは私がこれまでに持っているコードです:

if (secondary.height() <= 300) {
    secondary.css("height",300);
    secondary.hover(function(){
        jQuery('.comments-holder').css("height",mediumHeight);
    },
    function(){             
        jQuery('.comments-holder').css("height",minHeight);     
    });
} else {
    // DO SOMETHING ELSE
}

私が抱えている問題は、if ステートメントが意味するものに関係なく、.hover がトリガーされることです。

4

1 に答える 1

1

ホバー機能内の高さを確認します。

secondary.hover(function(){
    if (secondary.height() <= 300) {
      jQuery('.comments-holder').css("height",mediumHeight);
      }
},
function(){    
    if (secondary.height() <= 300) {         
     jQuery('.comments-holder').css("height",minHeight);    
    } 
});
于 2013-09-25T20:41:05.793 に答える