http://photo.163.com/shixiaojian089/train/28002 This is a photo album from NetEase. After seeing it, I wanted to try it.
In my production method, I need to get the width of each photo, so it is natural to use jq’s width() method. There is no big problem when running under FF and IE, but problems arise when running on chrome.
Use alert to troubleshoot and find that the values obtained by the width method under chrome are all 0. In this case, it seems that the image is not loaded at all when the script runs here. The problem should be with $(function(){});, because this method only requires the dom to be loaded before starting to run. Then change it to execute under onload, and sure enough it works now. However, this is obviously not a good idea. After all, running under onload requires waiting until all the contents of the entire file are loaded before running the script.
After searching online, I found this guy http://www.jb51.net/article/50402.htm also encountered the same problem. There is a message below his comment For solutions, please refer to:
Use