Evening all – Whats the best way to access an image’s height and width dynamically .
I want to add 20% to an images width and height and animate when the surrounding div is hovered, I guess I need to use ‘this’, but not sure how to access the image.
Any help greatfully received.
Cheers Paul
You could do something like this, using
.height()and.width()with function arguments:You can give it a try here, if you wanted a smooth animation you could store the initial height/width and
.animate(), like this:You can give it a try here, be sure to run either of these options in
$(window).load(), and not$(document).ready(), since the dimensions may not be loaded yet.