Jquery 如何在if语句中停止.悬停以防止触发?
每当div改变高度时,我试图停止.hover操作 这是我目前掌握的代码:Jquery 如何在if语句中停止.悬停以防止触发?,jquery,jquery-hover,Jquery,Jquery Hover,每当div改变高度时,我试图停止.hover操作 这是我目前掌握的代码: if (secondary.height() <= 300) { secondary.css("height",300); secondary.hover(function(){ jQuery('.comments-holder').css("height",mediumHeight); }, function(){ jQuer
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(secondary.height()检查悬停函数内的高度
secondary.hover(函数(){
if(secondary.height()将if语句移动到悬停事件处理程序内部,以便仅在条件为true时处理它。
secondary.hover(function(){
if (secondary.height() <= 300) {
jQuery('.comments-holder').css("height",mediumHeight);
}
},
function(){
if (secondary.height() <= 300) {
jQuery('.comments-holder').css("height",minHeight);
}
});