插件 Holder.js
图片占位符插件 holder.js 可以为图片生成一个占位符图片也可以为某个区域生成一个占位符图片。不依赖于 jquery 等第三方库。
Holder renders image placeholders on the client side using SVG
.
使用方法:
Include holder.js
in your HTML:
<script src="holder.js"></script>
Holder will then process all images with a specific src
attribute, like this one:
![](holder.js/300x200)
The above tag will render as a placeholder 300 pixels wide and 200 pixels tall.
![](holder.js/300x200)
To avoid console 404 errors, you can use data-src
instead of src
.
PLACEHOLDER
使用方法:
Just put your image size after our URL and you'll get a placeholder image.
Like this:
http://via.placeholder.com/350x150
You can also use it in your code, like this:
<a href="https://placeholder.com"><img src="http://via.placeholder.com/350x150"></a>