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. 树根 Digital root

    数根 (又称数字根Digital root)是自然数的一种性质.换句话说.每一个自然数都有一个数根.数根是将一正整数的各个位数相加(即横向相加),若加完后的值大于等于10的话,则继续将各位数进行横向相 ...

  2. elasticsearch搜索类型简单介绍

    简单搜索 GET请求很easy--你能轻松获取你想要的文档.让我们来进一步尝试一些东西.比方简单的搜索! 我们尝试一个最简单的搜索所有员工的请求: GET /megacorp/employee/_se ...

  3. Install Qt 5 on Ubuntu(使用qt-opensource-linux-x64-5.7.0.run进行安装,而且是官方的wiki)

    Introduction This is a tutorial for installation of Qt 5.7.0 to Ubuntu 12.10. It may be used also fo ...

  4. STL使用————SET&MULTISET

    SET函数的基本用法 by hhl 使用set的好处 1. 当增加元素后,集合会自动删重并从小到大排列(时间比快排还快)2. 相当于一棵伸展树(能快速求出后继) 使用基础 #include<se ...

  5. Android - TextureView, SurfaceView和GLSurfaceView 以及 SurfaceTexture

    这几个概念比较绕, 又比较相近. 初看比较糊涂, 把握关键点就好. 关键字 View SurfaceViewGLSurfaceViewTextureView这三个后缀都是View, 所以这三个东西都是 ...

  6. 1.windows编程常用

    1.画线 HDC hdc; hdc = ::GetDC(m_hWnd); ::MoveToEx(hdc, , , NULL); ::LineTo(hdc, , ); 2.填充矩形 HDC hdc; h ...

  7. android 客户端 Cookie处理

    Cookie,有时也用其复数形式Cookies,指某些网站为了辨别用户身份.进行session跟踪而储存在用户本地终端上的数据(通常经过加密). Cookie最早是网景公司的前雇员Lou Montul ...

  8. mini vimrc

    Mini version: set enc=utf-8 ffs=unix,dos,mac lm=zh_CN.utf-8 set nu nowb nocp nowrap ru nobk sm is no ...

  9. Windows 一键关闭UAC、防火墙、IE配置脚本

    有时候,在环境需求下,需要关闭windows防火墙,UAC,以及IE选项配置. 对不懂电脑来说是比较麻烦的,老是得教他们,关键还记不住…… so,以下脚本就可以解决这个问题 注:脚本 需要右键 以管理 ...

  10. 【转】Flash AS3.0 中的自定义事件

    原文 http://www.cnblogs.com/acpp/archive/2010/10/19/1855670.html package { import flash.events.Event; ...