Monday, 7 April 2014

Dynamic Div Height To Browser Window

I was trying it get a div to always be the height of the browser window and i finally got it to work with this code.

Set an article to 100% height 

Jquery

$('article') .css({'height': (($(window).height()))+'px'});
    $(window).resize(function(){
        $('article') .css({'height': (($(window).height()))+'px'});
    });

jsfiddle 

http://jsfiddle.net/Nitin_Grover/BPz7X/

No comments:

Post a Comment