holder.js的使用

一、总结

一句话总结:使用:holder.js后面接图片宽高

<img src="holder.js/300x200" />

1、holder.js的使用注意事项是什么?

使用:<img src="holder.js/300x200" />注意事项:300x200里面的符号是x,不是乘法号

2、holder.js后如何接类似主题这样的参数?

和url接参数的方式一致,?问号加参数(使用的时候失败了)

  • theme: The theme to use for the placeholder. Example: holder.js/300x200?theme=sky
  • random: Use random theme. Example: holder.js/300x200?random=yes

二、holder.js的使用

使用:<img src="holder.js/300x200" />注意事项:300x200里面的符号是x,不是乘法号

为了避免控制台404错误,您可以使用data-src代替src。<img data-src="holder.js/300x200" />

Placeholder options are set through URL properties, e.g. holder.js/300x200?x=y&a=b. Multiple options are separated by the & character.

  • theme: The theme to use for the placeholder. Example: holder.js/300x200?theme=sky
  • random: Use random theme. Example: holder.js/300x200?random=yes
  • bg: Background color. Example: holder.js/300x200?bg=2a2025
  • fg: Foreground (text) color. Example: holder.js/300x200?fg=ffffff
  • text: Custom text. Example: holder.js/300x200?text=Hello
  • size: Custom text size. Defaults to pt units. Example: holder.js/300x200?size=50
  • font: Custom text font. Example: holder.js/300x200?font=Helvetica
  • align: Custom text alignment (left, right). Example: holder.js/300x200?align=left
  • outline: Draw outline and diagonals for placeholder. Example: holder.js/300x200?outline=yes
  • lineWrap: Maximum line length to image width ratio. Example: holder.js/300x200?lineWrap=0.5
测试后的效果

There are 6 default themes: sky, vine, lava, gray, industrial, and social. Example: holder.js/300x200?theme=social
 
Themes
have 5 properties: fg, bg, size, font and fontweight.
The size property specifies the
minimum
font
size for the theme. The fontweight default
value is bold.
You
can create a sample theme like this:
 
<script type="text/javascript">
Holder.addTheme("red", {
bg: "#F00",
fg: "#aaa",
size: 11,
font: "Monaco",
fontweight: "normal"
});
</script>
自定义后直接使用:<img src="holder.js/300x200?theme=red" />

If you have a group of placeholders where you'd like to use particular text, you can do so by adding a text property
to the theme:

Holder.addTheme("thumbnail", { bg: "#fff", text: "Thumbnail" });

参考:holder.js的使用 - CSDN博客
https://blog.csdn.net/wang_magento/article/details/78799032

 
 

 

holder.js如何使用的更多相关文章

  1. html图片占位符插件holder.js

    1.下载源码 下载链接:http://www.bootcdn.cn/holder/ 2.在HTML中引入holde.js <script src="holder-js-2.9.4\ho ...

  2. 你需要了解的JS框架

    excanvas.js/Chart.js/cubism.js/d3.js/dc.js/dx.chartjs.js/echarts.js/flot.js       用途:构建数据统计图表,兼容多浏览器 ...

  3. 前端开发需要了解的JS插件

    excanvas.js/Chart.js/cubism.js/d3.js/dc.js/dx.chartjs.js/echarts.js/flot.js 用途:构建数据统计图表,兼容多浏览器 jquer ...

  4. bootstrap1

    让bootstarp3 支持ie的兼容模式: 支持浏览器的响应式布局: 是指网页既可以用在pc上,也可以用在手机上, 而且不需要修改源文件. bootstrap包括: css文件, 只需要加载: cs ...

  5. bootstrap--小李子demo

    最近忙啊...看到各位冬鞋都在认真写博客,认真敲代码,认真工作,总觉得自己时间太少,总觉得时间不够,老了...... 进正题: 上次不知从哪里(忘了)下载了bootstrap的一些使用小demo,以后 ...

  6. editplus中使用emmet?

    要用emmet生成html类型, 格式是: html:???, 意思是 都是html大类型, 小类型用冒号. 如:html:5, 或者全部都是! 则生成html5的类型文档. emmet是zen co ...

  7. bootstrap-carousel

    功能:轮播插件carousel, 主要用于首页大图片的显示与左右按钮的点击滑动图片 插件:carouse.js 要点:class="carousel slide"里的data-sl ...

  8. 15款增强web体验的Javascript库

    1. Pikaday: Standalone JavaScript Datepicker 这是一个令人耳目一新的JavaScript日期选择器 轻量轻(压缩和gzip后小于5KB) 没有依赖其它JS框 ...

  9. React+BootStrap+ASP.NET MVC实现自适应和组件的复用

    系统展示如下 1.前端采用bootstrap3进行架构 2.后端采用asp.net mvc进行开发 开发工具vs2010 mvc4需要安装sp1的补丁. 3.js组件的封装采用react 1.新建mv ...

随机推荐

  1. div和css:行内元素和块元素的水平和垂直居中

    行内元素: 水平居中:text-align:center ul水平居中:加 display:table; margin:0 auto; 此元素会作为块级表格来显示(类似 <table>), ...

  2. javaweb——登陆权限过滤器的编写

    http://blog.csdn.net/lzc4869/article/details/50935858

  3. POJ 3225 Help with Intervals(线段树)

    POJ 3225 Help with Intervals 题目链接 集合数字有的为1,没有为0,那么几种操作相应就是置为0或置为1或者翻转,这个随便推推就能够了,然后开闭区间的处理方式就是把区间扩大成 ...

  4. 大型网站架构之JAVA中间件

    中间件就是在大型网站中,帮助各子模块间实现互相访问,消息共享或统一访问等功能的软件产品.常见的有: 远程服务框架中间件:主要解决各子模块之间互相访问的问题. 消息队列中间件:主要解决各子模之间消息共享 ...

  5. Retrofit请求数据对错误以及网络异常的处理

    http://blog.csdn.net/jdsjlzx/article/details/51566683

  6. 原生ajax实现方式

    http://www.cnblogs.com/rubylouvre/archive/2013/01/08/2851051.html <!DOCTYPE html> <html lan ...

  7. A start job is running for Network Manager wait online (29s / no limit) 等待30s解决办法

    电脑安装openSUSE42.3和 Ubuntu16.04 双系统,当电脑插上网线后开机会出现A start job is running for Network Manager wait onlin ...

  8. js垃圾回收机制理解

    原理 找到不再被使用的变量,然后释放其占用的内存,但这个过程不是时时的,因为其开销比较大, 所以垃圾回收器会按照固定时间间隔周期性的执行 回收方式 a.标记清除 当变量进入环境时,将这个变量标记为“进 ...

  9. 数据库范式小结 1NF 2NF BCNF 3NF 4NF DB normal form

    1. 1NF指关系中的每个变量不可再分 2. 2NF指消除了非主属性对码(candidate key)的部分依赖的1NF 比如(S#,C#)-> SN ,(S#,C#)-> SD .S#- ...

  10. 关于bootstrap IE8的兼容性问题

    非常久没有写技术类的文章了.这几天在用bootstrap来做我们站点的UI框架,感觉还是不错的.只是遇到一点不大不小的问题,那就是有朋友在IE8下訪问我们的站点.界面变成了跟手机浏览一样的界面. 后来 ...