Ready and onload understanding
(function()) and (function(){}) and (function()) and ().ready(function(){}) are abbreviations for $(document).ready(function(){}). They are functions executed after the DOM tree is generated. At this point all the DOM has been generated but some resources have not been loaded, such as image resources. In H5, I need to get the height of the container supported by the image, but it fails because the image is not loaded. Js also has an onload event, which is a function that is executed after the DOM and page resources are loaded, so it can be done in the onLoad event.