JQuery // var theHeight = window height minus 50 pixels?

I get the window height as follows:

var theHeight = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight; 

I need a var variable that is Hex minus 50px

How to get it?

Thanks!

+6
source share
2 answers

If you use jQuery as your tag indicates, you can simply use:

 var theHeight = $(window).height() - 50; 
+13
source

That should do it. Just put it on the next line.

 theHeight -= 50; 
0
source

Source: https://habr.com/ru/post/911900/


All Articles