织梦dedecms首页,栏目页,列表页都可以很容易加上相对应的属性,但是在文章页中所有内容都是在编辑器中,我们可以换个思路,替换一下编辑器中的内容就可以达到我们想要的效果!文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html

下面把方法分享出来,希望可以帮助到需要这种效果的朋友!文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
修改目录include下的文件extend.func.php,在最后面添加一个函数方法文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
function replaceurl($newurl)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
$newurl=str_replace('src=','class="lazy" data-original=',$newurl);文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
return $newurl;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
另外调用文章正文内容的标签{dede:field.body/}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
需要改成:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
{dede:field.body function='replaceurl(@me)'/}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
然后在文章区域中添加好JS,这就成了我们想要的效果!如果列表图片多的话,你也可以把它做进列表页。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
然后在文章区域中添加好JS,这就成了我们想要的效果!文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
网站头部放入JS加载代码:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
<script src="http://www.hoogge.com/css/lazyload.js"></script>文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
内容区间放入以下JS代码:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
<script type="text/javascript" charset="utf-8">文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
$(function() {文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
$("img.lazy").lazyload({effect: "fadeIn"});文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
});文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
</script>文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
JS预加载插件:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html
最新版本 源代码和压缩代码. 插件已经在 OSX 的 Safari 5.1, Safari 6, Chrome 20, Firefox 12 浏览器上, Windows 的 Chrome 20, IE 8 and IE 9 浏览器上, 以及 iOS5 (iPhone 和 iPad) 的 Safari 5.1 浏览器上测试过.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/982.html