Home > Backend Development > PHP Tutorial > javascript - Ask a question about jquery.lazyload

javascript - Ask a question about jquery.lazyload

WBOY
Release: 2023-03-01 22:36:01
Original
906 people have browsed it

We know that to use jquery.lazyload, you need to put the image path in data-original
So, my website has been established for several months, and it seems to be quite troublesome to modify it one by one.
Is there any way to directly modify the img tag of the website? For example, use jquery or something like that

I hope someone can solve it

Reply content:

We know that to use jquery.lazyload, you need to put the image path in data-original
So, my website has been established for several months, and it seems to be quite troublesome to modify it one by one.
Is there any way to directly modify the img tag of the website? For example, use jquery or something like that

I hope someone can solve it

<code>let imgs = $("img");

imgs.each(function() {
    let src = $(this).attr('src');
    $(this).attr('data-original',src);
})</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template