Can you resize images to be fullscreen with javascript in the same way you can with flash?
Ive found this link but its for an entire plugin with slideshow, etc not just the feature I need for a more custom design: /
And this plugin seems to only with with background images: .html
Ideally id like to do this with jQuery. Thanks
Can you resize images to be fullscreen with javascript in the same way you can with flash?
Ive found this link but its for an entire plugin with slideshow, etc not just the feature I need for a more custom design: http://buildinternet./project/supersized/
And this plugin seems to only with with background images: http://www.ajaxblender./bgstretcher-2-jquery-stretch-background-plugin-updated.html
Ideally id like to do this with jQuery. Thanks
Share Improve this question asked May 23, 2011 at 14:19 EvanssEvanss 23.2k101 gold badges322 silver badges556 bronze badges3 Answers
Reset to default 5Here's an example of a basic implementation. It accounts for resizing of the window, but doesn't account for any focus point of the image and so the focus point could fall out of view for oddly-sized windows.
http://jsbin./okizi5
Edit: I forgot to point that that the width/height attributes on the image are necessary in this version for all browsers (notably Safari) to calculate the aspect ratio of the image. If your image is to be dynamic and the dimensions are not available then these could be calculated within the 'load' function bound to the window.
Yes. I don't see why you can't, really. You can use JavaScript, and its DOM interface, to modify the style properties of an image to resize an image. You don't even need a heavy library like jQuery; it's all native.
How about this:
$(window).resize(function() {
$('#myImgId').width($(window).width());
$('#myImgId').height($(window).height());
});
It will not maintain the aspect ratio...