During the development process, some pictures of the display, loading very slow, and then the image zoom into a thumbnail bar, the speed is fast but unclear, how to deal with such problems, the following to share their own treatment method.
Let the client load a small thumbnail of the pixel first:
then use JS processing:varNew Image (); // The large figure function() { document.getElementById (this . Src;}
Sample code
< Script language= "JavaScript" type= "Text/javascript" > varnew Image (); = "Images/playboy-b.jpg"; function () { document.getElementById (this. src; } </script>
Playboy-s is a thumbnail, playboy-b is the complete picture
This enables preloaded thumbnails to eventually display the high-pixel artwork, and the benefit is to prevent users from waiting for images for long periods of time to jump out of the picture or to fret about the product.
Original address: http://www.ibloger.net/article/403.html
"JavaScript" image loading from blur to clear--image optimization