Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a div hight to a certain percent of a window height using jQuery?

A rather basic question, I guess, but I want help with it.

I need to set up the height of div to 70% of the height of the browser window, and I want to do it with jQuery.

What's the best code for that?

Thank you for your help!

Dimitri Vorontzov

like image 615
Dimitri Vorontzov Avatar asked Dec 09 '22 08:12

Dimitri Vorontzov


1 Answers

$('#theDiv').height(function(){
   return $(window).height() * 0.7;
});
like image 99
Reigel Avatar answered Dec 14 '22 23:12

Reigel