devnumbertwo - $h!t for developers

View Original

changing image height with javascript not working

experimenting with javascript “animations” can be difficult. there are nuances that aren’t necessarily easily documented everywhere. one i found interesting was being unable to modify the size of an image if you have designated it’s size in a style.

the issue: trying to shrink an image

css code:

See this content in the original post

html code:

See this content in the original post

solution: remove the style designation of the width and height for your image. i've seen the width change in size even with leaving the declaration in but the height may not work.