HTML DOM Image naturalWidth, naturalHeight Property andrey понедельник, 18 августа 2014 г. No Comment

The Javascript's naturalWidth and naturalHeight properties will return original width and height of an image.
For an example, If we are using an image with 350px original width and 225px original height, It will return the same height and width even we made changes in DOM's height and width property.

The following DEMO will make you understand more what I'm saying. 


In this DEMO the original image size of image is 350 x 225 px. We are also changed image width and height property. But now also it's returning the actual size.



The Javascript's naturalWidth and naturalHeight properties will return original width and height of an image.
For an example, If we are using an image with 350px original width and 225px original height, It will return the same height and width even we made changes in DOM's height and width property.

The following DEMO will make you understand more what I'm saying. 


In this DEMO the original image size of image is 350 x 225 px. We are also changed image width and height property. But now also it's returning the actual size.



by Jillur Rahman

Jillur Rahman is a Web designers. He enjoys to make blogger templates. He always try to make modern and 3D looking Templates. You can by his templates from Themeforest.

Follow him @ Twitter | Facebook | Google Plus

No Comment