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. linux虚拟机拓展大小

    http://blog.csdn.net/wutong_login/article/details/40147057?utm_source=tuicool http://www.linuxidc.co ...

  2. hdu 1757 矩阵连乘

  3. ios 绘图,绘制坐标系,画坐标系

    先来看个效果: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/d ...

  4. cocos2d-x 学习资源整理(持续更新...)

    生活像一把无情刻刀.改变了我们模样.以前我以为会亘古不变的东西,突然在一瞬间失去了信念... 假设你改变不了生活中患得患失的心情.那就试着让自己变得强大一点.由于能做到不以物喜不以己悲都是建立在强大的 ...

  5. Linux常用截图软件

    1.Gnome-screenshot 是一款 GNOME 截图工具,顾名思义,它是一款用来对整个屏幕.一个特定的窗口或者用户所定义一些其他区域进行捕获的工具.该工具提供了几个其他的功能,包括对所捕获的 ...

  6. HDU-5307 He is Flying (FFT)

    Problem DescriptionJRY wants to drag racing along a long road. There are n sections on the road, the ...

  7. 研究一些复杂java开源软件代码的体会(转)

    原文地址:http://herman-liu76.iteye.com/blog/2349026     有时候看源代码是非常有趣的事情,象是思考游戏,象是思考棋局...     平时做J2EE项目中, ...

  8. cogs 1500. 误差曲线

    1500. 误差曲线 ★★   输入文件:errorcurves.in   输出文件:errorcurves.out   评测插件时间限制:1 s   内存限制:256 MB [题目描述] Josep ...

  9. struts2学习笔记(7)---数据验证之validateXxx()方法

    validateXxx()方法 上一篇文章写了使用Action的validate()方法,validate()仅仅能对action的所有方法进行验证.而要实现对action中特定的方法进行验证,就须要 ...

  10. 手动脱FSG壳实战

    作者:Fly2015 对于FSG壳.之前没有接触过是第一次接触.这次拿来脱壳的程序仍然是吾爱破解论坛破解培训的作业3的程序.对于这个壳折腾了一会儿,后来还是被搞定了. 1.查壳 首先对该程序(吾爱破解 ...