jquery cannot get a size solution for a picture under Google Chrome

Source: Internet
Author: User

jquery cannot get the size solution for a picture under Google Chrome:

This section describes the use of jquery under Google Browser can not get the image size, and in IE and Firefox browser can be normal, of course, not at any time can not get the image size, the following to explain how to solve the problem.

The code is as follows:

$ (document). Ready (function () {var img_h= $img. Height (); var img_w= $img. Width (); })

The above code in IE and Firefox is not a problem, but there may be problems in Google, the reason for the size of the goods is not loaded because the picture is not finished.

Here's how to modify it:

$ (document). Ready (function () {$img. Load (function () {var img_h= $img. Height ();   var img_w= $img. Width (); })})

The original address is: the Google browser under jquery can not get a picture of the size of the solution chapter.

The Web site is: jquery tutorial.

jquery cannot get a size solution for a picture under Google Chrome

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.