Im using the dimensions plugin. Although there is a possibility of absorbing it into jQuery in a future version.
Glen On 6/26/07, Alan Gutierrez <[EMAIL PROTECTED]> wrote:
Are you using the dimensions.js extension or does jquery.js now support true width and height? What about top and left? On Jun 24, 2007, at 1:56 AM, Glen Lipka wrote: > Felix Geisend hooked me up with some code, which seemed to work > perfectly.function fitObjectInViewPort(zoomedImage) > { > // Fit's our image in a box with a given width and heigth while > proportions remain, > // *or* resizes it based on one site proportionally if only > width or height is given > > var objectWidth = zoomedImage.width(); > var objectHeight = zoomedImage.height(); > > var boxWidth = ($(window).width()) * maxImagePercent; > var boxHeight = ($(window).height()) * maxImagePercent; > > widthRatio = (boxWidth / objectWidth); > heightRatio = (boxHeight / objectHeight); > > if ((widthRatio < heightRatio) && (widthRatio!=0) || > (heightRatio==0)) > { > ratio = widthRatio; > } > else > { > ratio = heightRatio; > } > > new_width = Math.ceil(objectWidth * ratio); > new_height = Math.ceil(objectHeight * ratio); > > //return array(new_width, new_height); > > new_left = (boxWidth - new_width) / 2; > new_top = (boxHeight - new_height) / 2; > > bigThumb.animate({width:new_width,height:new_height}, {duration: > 750, easing: "backinout"}); > > } -- Alan Gutierrez | [EMAIL PROTECTED] | http://blogometer.com/ | 504 717 1428 Think New Orleans | http://thinknola.com/