Tuesday, 3 January 2012

jQuery Example - Change popup div Height based on Browser Size/Resize

<p>In this example I am going to show an example for set a height a of an element according the browser height.</p>
<p>To get browser height we will use $(window).height(); property and we set page elements based on Window size re-size.</p>
<code><p>$(function(){<br />
    $(window).resize(function(){<br />
        var winHeight = $(window).height();<br />
        var winWidth = $(window).width();<br />
        $("#popBox").css('height',(h < 1024 || w < 800) ? 600 : 450);<br />
    });<br />
});</p></code>

No comments:

Post a Comment