zoukankan      html  css  js  c++  java
  • jquery Loading图片延迟加载特效

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>jquery图片延迟加载</title>
    <script src="js/jquery-1.6.js" type="text/javascript"></script>
    <script src="js/lyz.delayLoading.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
    	$("img").delayLoading({
    		defaultImg: "images/loading.jpg",    // 预加载前显示的图片
    		errorImg: "",                        // 读取图片错误时替换图片(默认:与defaultImg一样)
    		imgSrcAttr: "originalSrc",           // 记录图片路径的属性(默认:originalSrc,页面img的src属性也要替换为originalSrc)
    		beforehand: 0,                       // 预先提前多少像素加载图片(默认:0)
    		event: "scroll",                     // 触发加载图片事件(默认:scroll)
    		duration: "normal",                  // 三种预定淡出(入)速度之一的字符串("slow", "normal", or "fast")或表示动画时长的毫秒数值(如:1000),默认:"normal"
    		container: window,                   // 对象加载的位置容器(默认:window)
    		success: function (imgObj) { },      // 加载图片成功后的回调函数(默认:不执行任何操作)
    		error: function (imgObj) { }         // 加载图片失败后的回调函数(默认:不执行任何操作)
    	});
    });
    </script>
    <style type="text/css">
    .box{ 1200px; margin:0 auto;}
    .box ul li { 245px; height:245px; float:left; margin:10px; border:1px solid #e6e6e6; list-style:none; }
    .box ul li img{ 100%; min-height:245px;}
    </style>
    </head>
    <body>
    	<div class="box">
    		<ul>
    	        <li><img originalsrc="images/1.jpg" /></li>
    	        <li><img originalsrc="images/2.jpg" /></li>
    	        <li><img originalsrc="images/3.jpg" /></li>
    	        <li><img originalsrc="images/4.jpg" /></li>
    	        <li><img originalsrc="images/5.jpg" /></li>
    	        <li><img originalsrc="images/6.jpg" /></li>
    	    </ul>
    	</div>
    </body>
    

      

  • 相关阅读:
    CentOS6.8上Docker的安装
    IDE- VS Code-插件-Golang
    Tool-Docker-First exploration
    C++-Code-Time Transfer-Windows FILETIME(1601) To 1970 UTC
    Tool-git-command-入门笔记[慕课网-五月的夏天]
    C++-当表达式中同时存在有符号和无符号的类型时,有符号类型先转为无符号参与计算
    C语言-C语言程序设计-Practice code
    C语言-C语言程序设计-Function-strcpy
    C语言-C语言程序设计-Function-fopen
    C语言-C语言程序设计-Application-逆波兰计算器
  • 原文地址:https://www.cnblogs.com/adtuu/p/4670319.html
Copyright © 2011-2022 走看看