


Image Lazy Load: Those open source plug-ins (jQuery) that delay loading images
The image delayed loading technology is very practical for websites with high traffic. Currently, images are widely used in websites. If they are not processed, they will put great pressure on the server and bandwidth. By only rendering images in the area visible to the current user, you can greatly reduce the number of website requests and reduce network bandwidth resources.
unveil
This is a very lightweight short-time image loading component
It supports modern browsers and IE7+, and there are nearly 3K stars (follows) on Github
Use
General pictures
<img src="/static/imghwm/default1.png" data-src="bg.png" class="lazy" data- / alt="Image Lazy Load: Those open source plug-ins (jQuery) that delay loading images" >
For support Retina (retina screen) device
<img src="/static/imghwm/default1.png" data-src="bg.png" class="lazy" data- data-src-retina="img2-retina.jpg" / alt="Image Lazy Load: Those open source plug-ins (jQuery) that delay loading images" >
Application
$(document).ready(function() { $("img").unveil(); });
Support callback
$("img").unveil(200, function() { $(this).load(function() { this.style.opacity = 1; }); });
Support manual trigger
$("img").trigger("unveil");
jquery_lazyload
Can delay loading of images of large websites, and then render when scrolling to the area. There are 4K followers on Github.
Use
Reference jQuery and lazyload.js
<script src="jquery.js" type="text/javascript"></script> <script src="jquery.lazyload.js" type="text/javascript"></script>
Images that need to be delayed loaded
<img class="lazy lazy" src="/static/imghwm/default1.png" data-src="img/blank.gif" data-original="img/example.jpg" style="max-width:90%" style="max-width:90%" alt="Image Lazy Load: Those open source plug-ins (jQuery) that delay loading images" >
Apply
$(function() { $("img.lazy").lazyload(); });
echo
An independent logo-type JavaScript image delayed loading library. Does not rely on jQuery, only 2K after compression.
Support IE8+
Use
<img class="lazy lazy" src="/static/imghwm/default1.png" data-src="img/blank.gif" alt="Image Lazy Load: Those open source plug-ins (jQuery) that delay loading images" > <script></script> <script> echo.init({ offset: 100, throttle: 250, unload: false, callback: function (element, op) { console.log(element, 'has been', op + 'ed') } }); // echo.render(); //手动触发调用 </script>
layzr.js
An Image Lazy Loading component just released a few days ago, which is small, fast and has no dependencies (does not rely on jQuery), and also supports retina devices.
<script src="layzr.min.js"></script> <img src="/static/imghwm/default1.png" data-src="optional/placeholder" class="lazy" data-layzr="normal/image" data-layzr-retina="optional/retina/image" alt="Image Lazy Load: Those open source plug-ins (jQuery) that delay loading images" > <script> var layzr = new Layzr({ attr: 'data-layzr', retinaAttr: 'data-layzr-retina', threshold: 0, callback: null }); </script>
Updated
So, how to let the server convert a bunch of img in HTML into data-src? In fact, it is very simple, just a few lines of regular rules are enough. For example, in node.js, you can convert img's src into data-src (you can directly press F12 to run it in the browser's Console)
var html = '包含 <img src="/static/imghwm/default1.png" data-src="http://ourjs.com/img/weixin.jpg" class="lazy" alt="Image Lazy Load: Those open source plug-ins (jQuery) that delay loading images" > 的HTML' html = html.replace(/<img [^ alt="Image Lazy Load: Those open source plug-ins (jQuery) that delay loading images" >]+>/g, function(imgstr, idx) { imgstr = imgstr.replace(' src=', ' data-src=') return imgstr })

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
