加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

twitter-bootstrap-4 – 为什么Bootstrap 4卡片图像使用data-src

发布时间:2020-12-17 21:30:41 所属栏目:安全 来源:网络整理
导读:在下面的演示代码中,它使用data-src但不使用img src.如何应用图像? javascript是否以某种方式修改了这个? http://v4-alpha.getbootstrap.com/components/card/ div class="card" img class="card-img-top" data-src="..." alt="Card image cap" div class=
在下面的演示代码中,它使用data-src但不使用img src.如何应用图像? javascript是否以某种方式修改了这个?

http://v4-alpha.getbootstrap.com/components/card/

<div class="card">
      <img class="card-img-top" data-src="..." alt="Card image cap">
      <div class="card-block">
        <h4 class="card-title">Card title</h4>
        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
        <a href="#" class="btn btn-primary">Button</a>
      </div>
    </div>

解决方法

Bootstrap 4文档使用holder.js,参见 http://imsky.github.io/holder/

另见:https://github.com/imsky/holder#usage

Include holder.js in your HTML:

Holder will then process all images with a specific src attribute,
like this one:

The above tag will render as a placeholder 300 pixels wide and 200
pixels tall.

To avoid console 404 errors,you can use data-src instead of src.

持有人通过http://v4-alpha.getbootstrap.com/assets/js/docs.min.js包括在内

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读