Javascript 如何使用 Jquery 检查 div 的高度是否大于 700px?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3566388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 05:13:22  来源:igfitidea点击:

How do I check if the height of a div is greater than 700px, using Jquery?

javascriptjquery

提问by Nasir

I was wondering, how I check if the height of a div is greater than 700px, using Jquery?

我想知道,如何使用 Jquery 检查 div 的高度是否大于 700px?

Any help would greatly be appreciated. Thanks

任何帮助将不胜感激。谢谢

回答by BoltClock

if ($('#mydiv').height() > 700) {
    // Greater than 700px in height
}

回答by karim79

alert($("#theDiv").height() > 700);

Reference: http://api.jquery.com/height/

参考:http: //api.jquery.com/height/