24HUI - 图片懒加载(hui-lazy)

简介: 24HUI - 图片懒加载(hui-lazy)

效果图

示例代码

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI</title>
<link rel="stylesheet" type="text/css" href="../css/hui.css" />
</head>
<body>
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>HUI </h1>
</header>
<div class="hui-wrap">
    <div class="hui-common-title" style="margin-top:15px;">
        <div class="hui-common-title-line"></div>
        <div class="hui-common-title-txt">懒加载演示</div>
        <div class="hui-common-title-line"></div>
    </div>
    <style>
    #list2 li{width:50%; float:left; margin:5px 0px;}
    #list2 .hui-img-list-content{padding:5px; padding-bottom:10px;}
    #list2 h1{font-size:14px;}
    </style>
    <div class="hui-img-list" id="list2">
        <ul>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/1.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/2.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/3.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/4.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/1.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/2.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/3.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/4.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/1.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/2.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/3.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
            <li>
                <a href="javascript:hui.toast('hi...');">
                    <img lazySrc="../img/imglist/4.jpg" src="../img/lazy.png" class="hui-lazy" />
                    <div class="hui-img-list-content">
                        <h1>标题内容....</h1>
                        <p>power by hcoder.net</p>
                    </div>
                </a>
            </li>
        </ul>
    </div>
    <div style="height:50px;"></div>
</div>
<script src="../js/hui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
hui.lazyLoad();
</script>
</body>
</html>
目录
相关文章
15HUI - Loading动画(hui.loading)
15HUI - Loading动画(hui.loading)
53 0
15HUI - Loading动画(hui.loading)
|
JavaScript
25HUI - 下拉刷新(hui-loading-wrap)
25HUI - 下拉刷新(hui-loading-wrap)
63 0
07HUI - 普通列表(hui-list)
07HUI - 普通列表(hui-list)
44 0
|
JavaScript
10HUI - 按钮(hui-button)
10HUI - 按钮(hui-button)
61 0
|
3天前
|
前端开发 API UED
React 懒加载图片 Lazy Image
懒加载是一种优化技术,通过延迟加载不在视口内的图片,减少初始页面加载时间,提升用户体验。本文从基础概念入手,逐步探讨 React 中实现图片懒加载的常见问题、易错点及解决方案,并通过代码案例详细解释。
12 3
03HUI -基础文本(hui-common-title)
03HUI -基础文本(hui-common-title)
52 0
17HUI - 进度条(hui-progress)
17HUI - 进度条(hui-progress)
42 0
17HUI - 进度条(hui-progress)
11HUI - 数字标识(hui-badge)
11HUI - 数字标识(hui-badge)
48 0
11HUI - 数字标识(hui-badge)
26HUI - 上拉加载(hui-refresh)
26HUI - 上拉加载(hui-refresh)
59 0
|
JavaScript
20HUI - 标签组件(hui-tags)
20HUI - 标签组件(hui-tags)
59 0