Most jquery instances or tutorials tell us to bind our jquery code to $ (document). Ready event.
Although the $ (document). Ready event is OK in most cases, it is parsed in the order that the document is prepared, but objects such as pictures in the document are running when the object is being downloaded.
So at some point, use $ (document). The Ready event does not necessarily achieve the results we expect, such as some visual effects and animations, drag-and-drop, pre-read hidden images ...
By using the $ (window). Load event It is safe to start running the code you expect after the entire document is ready.
$ (window). Load (function() {
// Place the code that you want to run after the page is fully ready
});
Google Chrome, for example: If you use $ (document) for the width of the image. Ready () is not available
You will use $ (window) at this time. Load ();
$ (window). Load () and $ (document). Ready ();