Preloading images will make your application a bit faster by making it lightweight. It is very simple and easy to create and load DOM elements (in this case referring to images) with jQuery. If you want to preload images using jQuery there here is a detailed explanation on how you can do this:
• The foremost thing you need to do is create an image DOM element by providing a value for the src attribute for the image so that the web browser will know which image it has to load i.e. preloading the image. You can make use of the below code snippet for preloading an image using jQuery :

1
2
// Create an image DOM  element
var image1 = $('<img alt="" />').attr('src', 'link.jpg');

• Once you are done with creating the DOM image element you must insert this DOM image element inside the DOM tree by making use of any of the DOM manipulation methods. The most excellent method of doing this is to use the callback method so that it will insert the preloaded image directly into your application once it has completed loading.
• One more way is to 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/

Preloading an Image with jQuery--reference的更多相关文章

  1. 最新JavaScript、Ajax典藏级学习资料下载分类汇总 (2011年12月21日更新)

    其他网站开发相关资料            超强HTML和xhtml,CSS精品学习资料下载汇总                                               最新htm ...

  2. SingalR--demo

    原文链接 : http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr-and ...

  3. 解决VS2013+IE11调试DevExpress ASP.NET MVC的性能问题

    将一个MVC项目从12.2升级到14.2,VS2012升到2013,发现使用IE11调试非常慢卡死,CPU占用100%,后来经过排除,发现只有DevExpress的MVC项目有这个问题. 最后在Dev ...

  4. (3)选择元素——(16)延伸阅读(Further reading)

    The topic of selectors and traversal methods will be explored in more detail in Chapter 9. A complet ...

  5. Learn HTML5 in 5 Minutes!

    There's no question, HTML5 is a hot topic for developers. If you need a crash course to quickly unde ...

  6. Promise & Deferred Objects in JavaScript Pt.2: in Practice

    原文:http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt2-practical-use Intr ...

  7. SignalR 教程二 服务端广播

    转帖官方教程:Tutorial: Server Broadcast with SignalR 2 http://www.asp.net/signalr/overview/getting-started ...

  8. SignalR 教程一

    转帖官方教程:Tutorial: Getting Started with SignalR 2 and MVC 5 http://www.asp.net/signalr/overview/gettin ...

  9. 转:Generating PDFs from Web Pages on the Fly with jsPDF

    The Portable Document Format has been one the major innovations in the fields of desktop publishing ...

随机推荐

  1. javascript常用内置对象总结(重要)

    Javascript对象总结 JS中内置了17个对象,常用的是Array对象.Date对象.正则表达式对象.string对象.Global对象 Array对象中常用方法: Concat():表示把几个 ...

  2. PHP中截取中文乱码

    大家都知道,一个汉字在gb2312下面是占2个字节,用传统的substr肯定会出问题 ,所以应该用,mb_substr和mb_strcut两个函数 在这个之前,打开php.ini打开php_mbstr ...

  3. 【Windows核心编程】Windows常见数据类型

    一,常见数据类型 WORD:               16位无符号整形数据 DWORD:             32位无符号整型数据(DWORD32) DWORD64:         64位无 ...

  4. Groovy学起来,这要和GRAILS,RUNDECK打成一片

    还好,以前看过RUBY和JAVA,GROOVY感觉和它们有点相似.. 并且,我觉得这个GROOVY比SCALA要简单些(函数式编程+OBJ) 作类比,毕竟是最快的学习方法. XXX,还有必修课和证券从 ...

  5. 使用 Java 开发兼容 IPv6 的网络应用程序

    根据现有 IPv4 地址的部署速度,剩余的地址将在 10 到 20 年被使用殆尽.因此网络逐渐从 IPv4 向 IPv6 转换是不可避免的,相应的各种网络应用程序都将支持 IPv6.对于 Java,从 ...

  6. Oracle 多版本控制

    SESSION 1: SQL> create table t 2 as 3 select * from all_users; Table created. SQL> variable x ...

  7. [LeetCode#136, 137]Single Number, Single Number 2

    The question: Single Number Given an array of integers, every element appears twice except for one. ...

  8. bzoj3043

    这道题完全没想出来,引自 http://blog.csdn.net/willinglive/article/details/38419573的题解 对于带有“将一段区间内的每个数全部加上某个值”这种操 ...

  9. 南桥先生谈《OUTLIERS》

    借来一套语音版的 Outliers 听完了.这本书里有很多故事,可是希望借此找到成功的奥秘恐怕很难,作者做的是一描述而不是预见.听了半天,只听出了六个字: “天时地利人和”. 比如比尔·盖茨,他之所以 ...

  10. 数学:UVAoj 11174 Stand in a Line

    Problem J Stand in a Line Input: Standard Input Output: Standard Output All the people in the bytela ...