Preloading an Image with jquery--reference

Source: Internet
Author: User

Preloading images would make your application a bit faster by making it lightweight. It is very-simple and easy-to-create and load DOM elements-in-referring to images-with jQuery. If you want to preload the images using jQuery there here's a detailed explanation on how can does this:
the foremost thing you need to do are create an image DOM element by providing a value for the SRC attribute for the Imag e So, the Web browser would know which image it had to load i.e. preloading the image. You can make use of the below code snippet for preloading an image using JQuery:

12
Create an image DOM Elementvar image1 = $ ('  '). attr (' src ', ' link.jpg ');

once you do with creating the DOM image element you must insert this DOM image element inside the DOM tree by Maki ng use of any of the DOM manipulation methods. The most excellent method of doing the-is-to-use, the callback method so, it would insert the preloaded image directly into your application once it has completed loading.
one more the by-make use of a jQuery plug-in to preload the image.

Reference from:http://www.webdeveloperjuice.com/2014/08/06/preloading-an-image-with-jquery/

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.