jQuery实现图片预加载效果
本文实例讲述了jQuery实现图片预加载效果代码。分享给大家供大家参考。具体如下:
运行效果截图如下:
具体代码如下:
html代码:
<div class="main"> <br> <div class="title">图片预加载</div> <div class="content"> <div class="img"> <a href=""> <img lazyloadsrc="images/1.jpg" alt="" width="200" height="120"> </a> <span class="loading"></span> </div> <div class="img"> <a href=""> <img lazyloadsrc="images/2.jpg" alt="" width="200" height="120"> </a> <span class="loading"></span> </div> <div class="img"> <a href=""> <img lazyloadsrc="images/3.jpg" alt="" width="200" height="120"> </a> <span class="loading"></span> </div> <div class="img"> <a href=""> <img lazyloadsrc="images/4.jpg" alt="" width="200" height="120"> </a> <span class="loading"></span> </div> <div class="img"> <a href=""> <img lazyloadsrc="images/5.jpg" alt="" width="200" height="120"> </a> <span class="loading"></span> </div> <div class="img"> <a href=""> <img lazyloadsrc="images/6.jpg" alt="" width="200" height="120"> </a> <span class="loading"></span> </div> </div> </div>
js代码:
$(function () { $("[lazyLoadSrc]").YdxLazyLoad({ onShow: function () { $(this).parent().next().hide() } }); });
本文已被整理到了《jquery图片加载方法汇总》,欢迎大家学习阅读。
大家在加载图片时就会看到这种效果,现在知道是实现的过程了吧,希望大家喜欢小编分享的jQuery实现图片预加载效果。
相关推荐
EdwardSiCong 2020-11-23
85477104 2020-11-17
hhanbj 2020-11-17
81427005 2020-11-11
seoppt 2020-09-13
honeyth 2020-09-13
WRITEFORSHARE 2020-09-13
84483065 2020-09-11
momode 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
82550495 2020-08-03
tthappyer 2020-08-03
84901334 2020-07-28
tthappyer 2020-07-25
TONIYH 2020-07-22
tztzyzyz 2020-07-20
83510998 2020-07-18
81463166 2020-07-17