I am attempting to set the height of a container based on its width multiplied by .75.
I’ve come up with this but not sure where I’ve gone wrong because it doesn’t work:
$('#slideContent').load(function() {
var wide = ('#slideContent').width()
$(this).css('height', $(this).width( wide * 0.75 ));
});
Any advice?
Thanks
Try this now.
First i take the width of the element and store it in “wide” variable.
Secondly i make a calculation variable. When asking for a width or height from a CSS styled element you will have a value returned as a string containing “px”, to filter off this “px” and make it an integer i use the “parseInt()” function. The “, 10” makes sure it’s a radix 10 number.
The rest should make sense pretty much by itself i believe.