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. phpcms v9后台美化需要修改的部分整理

    PHPcms后台登陆后的页面修改 Phpcms->modules->admin->templates->main.tpl.php 1,安全提示部分 <h6>< ...

  2. asp.net MVC 从其它项目复制过来的Area里面的Controllers文件读取不到

    从其实项目复制过来的Controllers,在访问时显示不存在文件 检查一下对应的area里面的AreaRegistration文件的命名空间是否一致

  3. 如何编写一个简单的makefile

    一个规则的构成 目标:依赖1,依赖2······ 命令 例子: objs := init.o nand.o head.o main.o nand.bin : $(objs) arm-linux-ld ...

  4. 转:Win7 IIS7应用PHP Manager使用FastCGI通道快速部署PHP支持

    原文来自于:http://www.jb51.net/os/windows/62390.html 正常情况下,我们在Windows系统中部署WEB服务器(iis)支持PHP是采用ISAPI通道.参照这篇 ...

  5. 巧用powerpoint制作符合期刊要求的复合图

  6. unity3d中的http通信 二

    转载自 http://www.cnblogs.com/88999660/archive/2013/03/11/2954279.html 如果侵权,请及时通知我删除! using System; usi ...

  7. 大用处--PowerShell Management Library for Hyper-V.

    http://pshyperv.codeplex.com/releases 用脚本来收集及集成HYPER-V管理. 越来越似KVM,LIBVIRT啦.

  8. texedo 分布式事务

    1.问题现象 但是实际情况,完全出乎笔者的想法.检查一般对象数据表锁定,只需要检查v$locked_object和v$transaction视图,就可以定位到具体人.但是检查之后的结果如下: SQL& ...

  9. Oracle索引扫描算法

    SQL> create table t as select * from dba_objects; Table created. SQL> create index idx_t on t( ...

  10. C# 绘图对象 流对象 响应对象关系