Using JS to find screen height, then apply it to a div class through CSS

Phaz

New Member
I'm working on a single-page scroll-to webdesign, and can't get this code to work.What I'm trying to do is get the screen height of the user through JavaScript.Then I want to apply this screen height to my div class, so that I'll always have a container that is the size of the users screen resolution. A liquid design that always fits the screen, so to speak. Here's a short example of where I want the variable screen height to be:\[code\]<script type="text/javascript">function matchHeight() {$('.container').css('height',$(window).height);};</script>\[/code\]\[code\]<div class="container"> I want this container to be the height of the users screen resolution. </div>\[/code\]\[code\].container { width:100%; height: /* javascript value */ }\[/code\]Help will be highly appreciated! Thanks in advance.Edit: I've added a Fiddle of my complete document.
 
Back
Top