评估身高不 return 正确的值
Evaluating heights doesn't return right value
我正在尝试通过 jquery 处理某些 css 页面加载时的视口不垂直包含某些特定元素。所以我试图评估 window 的高度是否小于这些元素的高度总和。问题是这个条件
var winH = parseInt($(window).height());
var topH = parseInt($("#name").height()) + parseInt($("#head-001").height());
if( winH > topH);
{
//$("#wrapper").css("top", window.innerHeight - $("#first-bar").height()); what I want to be done if condition passes
console.log(winH + " + " + topH + " =");
console.log(winH + topH);
}
尽管根据两行测试。
知道为什么吗?谢谢。
去掉if语句后面的分号:
if( winH > topH)
我正在尝试通过 jquery 处理某些 css 页面加载时的视口不垂直包含某些特定元素。所以我试图评估 window 的高度是否小于这些元素的高度总和。问题是这个条件
var winH = parseInt($(window).height());
var topH = parseInt($("#name").height()) + parseInt($("#head-001").height());
if( winH > topH);
{
//$("#wrapper").css("top", window.innerHeight - $("#first-bar").height()); what I want to be done if condition passes
console.log(winH + " + " + topH + " =");
console.log(winH + topH);
}
尽管根据两行测试。
知道为什么吗?谢谢。
去掉if语句后面的分号:
if( winH > topH)