I am trying to resize a container div depending on the size of the window. The ratio of height to width is the most important aspect here, and I want to maximize the size of the container in any direction (height or width) that most limits this ratio. I tried several things unsuccessfully when this was the very last:
$(window).load(function() { var h = $(window).height(); var w = $(window).width(); If((h/w)>0.61){ $('#container').css({'height': h, 'width':h*1.64}); } else{ $('#container').css({'height': w/1.64, 'width':w}); } })
What do I need to change to resize the window? Is there a better way to approach this?
Thanks in advance for any help. I am completely new to javascript / jQuery and could not find any useful information ... this thing is driving me crazy ...
source share