How to set div height to a specific percentage of window height using jQuery?

Pretty simple question, but I want to help with it.

I need to adjust the height of the div to 70% of the height of the browser window, and I want to do this using jQuery.

What is the best code for this?

Thank you for your help!

Dimitry Vorontsov

+4
source share
2 answers
$('#theDiv').height(function(){ return $(window).height() * 0.7; }); 
+12
source
0
source

All Articles