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

javascript - Ask a question about jquery.lazyload

WBOY
WBOYOriginal
2016-12-01 00:56:37894browse

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>
Statement:
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