[英]JQuery Get element .height() then subtract 100vh?
How would one subtract a 100vh from a .height() value for example $('#luxy').height();
如何从 .height() 值中减去 100vh,例如
$('#luxy').height();
the height is 5000px I want to take 100vh from the 5000px using jQuery or Javascript not CSS?高度是 5000px 我想使用 jQuery 或 Javascript 而不是 CSS 从 5000px 中取 100vh?
vh
is a unit representing 1% of the V iewport H eight vh
是表示在V的1%iewportħ八个单元
window.innerHeight
is the px value of the height of the viewport window.innerHeight
是视口高度的px值
Being as both of these are targeting the layout viewport , you should be fine to do:由于这两个都针对布局viewport ,您应该可以这样做:
let myHeight = $('#luxy').height() - window.innerHeight;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.