Calculate proportional width of object (proportion: 1600x1080)
Posted
by Hans Stauden
on Stack Overflow
See other posts from Stack Overflow
or by Hans Stauden
Published on 2010-03-22T09:54:12Z
Indexed on
2010/03/22
10:01 UTC
Read the original article
Hit count: 272
Hello,
this jquery question: when I set a specific height to a "#div", i want to set the width of a inner object automatically too (cause i need a width to read it out)
[ "#div"
["object"]
]
example:
(object).css(width: [ CALCULATION ], height: ($("#div").height())+'px' )
the original proportion of the image is: 1600x1080
here's the link to the attachment, take a look at it (tinypic): link text
the heights "500px", "600px" and "700px" you can see in the attachment are just examples, the heigth could also be "711px", "623px", "998px" etc. cause the "#div" scales with the browser (i can read out the height of window, that works)
my math skills aren't really good, would be great if someone could help me out :-)
© Stack Overflow or respective owner