博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Preloading an Image with jQuery--reference
阅读量:6614 次
发布时间:2019-06-24

本文共 1174 字,大约阅读时间需要 3 分钟。

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 :

12
// Create an image DOM  elementvar image1 = $('').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/

转载地址:http://smhso.baihongyu.com/

你可能感兴趣的文章
JS实现动态显示当前时间
查看>>
ip policy route-map在VLAN上不能应用的解决办法-SDM_quanshengaa-ChinaUnix博客
查看>>
linux 计划任务习题
查看>>
asm示例
查看>>
Web.py HelloWorld与中文乱码
查看>>
表单验证提示插件validate
查看>>
C语言中extern关键字用法
查看>>
Centos7的安装及基本优化
查看>>
我的友情链接
查看>>
企业数据备份流程
查看>>
JNI之C++调用Java类
查看>>
vmware12
查看>>
thinkphp基础学习简单条件查询
查看>>
XenApp / XenDesktop 7.6 初体验六 Remote PC Access
查看>>
Django CSRF 简述
查看>>
翻编-JavaScript有关的10个怪癖和秘密
查看>>
Discuz!X论坛开发(五)二次开发 教你识别程序目录和文件列表for discuzx!1--NO.4
查看>>
Swift编写的一些完整的app
查看>>
[转]Apache与Tomcat的区别
查看>>
我的友情链接
查看>>