zoukankan      html  css  js  c++  java
  • [HTML5] Lazyload below the fold images and iframes with native browser lazy-loading

    In this lesson, you'll learn how to use the loading="lazy" attribute available on images and iframes to lazily load below the fold images, which saves bandwidth and increases the load time performance of web pages. You'll also learn how to prevent images from lazy loading if necessary, and how to add lazy loading to responsive images as well. Lazy loading is supported in Chrome 76, and will be available in the next version of Edge and has public signals of support from Firefox, and Safari as well.

    <!DOCTYPE html>
    <style>
      img { 
        border: 1px solid black;
        display: block;
        width: 400px;
        height: 1000px;
      }
    </style>
    <img loading="lazy" src="https://via.placeholder.com/400x1000"/>
    <img loading="lazy" src="https://via.placeholder.com/400x1001"/>
    <img loading="lazy" src="https://via.placeholder.com/400x1002"/>
    <img loading="lazy" src="https://via.placeholder.com/400x1003"/>
    <picture>
      <source media="(min- 100px)" srcset="https://via.placeholder.com/1200x3000">
      <img loading="lazy" src="https://via.placeholder.com/400x1004"/>
    </picture>
    <img loading="lazy" 
      srcset="https://via.placeholder.com/400x1005 400w, https://via.placeholder.com/800x2010 800w"/>
    <iframe loading="lazy" src="http://example.com" width="400" height="400"></iframe>
  • 相关阅读:
    Servlet常用类
    Java库使用----xstream1.3.1
    字符串处理---统计每一行字符串当中的字符“u”个数
    读写锁
    求阶乘
    Fibonacci数列
    22.2-按照升序显示不重复的单词
    22.1-在散列集上进行集合操作
    完美世界-2015校园招聘-java服务器工程师-成都站
    运用jQuery写的验证表单
  • 原文地址:https://www.cnblogs.com/Answer1215/p/11335545.html
Copyright © 2011-2022 走看看