如何停止在博客主页面中加载帖子图像? [英] How to stop post images loading in blogger main page?

查看:87
本文介绍了如何停止在博客主页面中加载帖子图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帖子页面内部的图像正在博客主页面上加载.我想发布仅加载帖子页面的帖子图像.如果您有此问题的答案.请告诉我.谢谢你. 这是我的博客网址: http://sritestweb.blogspot.com/

Images that inside post pages is loading on blogger main page. I want to that post images loading only post page. If you have answer for this problem. Please let me know. Thank you. This is my blogger URL: http://sritestweb.blogspot.com/

推荐答案

这对我来说很好.请检查. "default.jpg"是要在实际图像加载之前显示的图像.保持"default.jpg"的大小最小.

This works fine for me. Please check. 'default.jpg' is the one which you want to show before the actual image load. Keep the size of 'default.jpg'to minimum.

<!DOCTYPE HTML>
<html>

<head>
<script>
    function init() {
        var imgDefer = document.getElementsByTagName('img');
        for (var i=0; i<imgDefer.length; i++) {
        if(imgDefer[i].getAttribute('data-src')) {
        imgDefer[i].setAttribute('src',imgDefer[i].getAttribute('data-src'));
    } } }

</script>
</head>
<body onload="init()">
<img data-src="original-image1.jpg"  src="default.jpg">
</img>

<img data-src="original-image2.jpg" src="default.jpg">
</img>

</body>
</html>

这篇关于如何停止在博客主页面中加载帖子图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆