Home  >  Article  >  Web Front-end  >  使用Sticker.js实现贴纸效果_javascript技巧

使用Sticker.js实现贴纸效果_javascript技巧

WBOY
WBOYOriginal
2016-05-16 16:17:241643browse

  Sticker.js 是一个很小的 JavaScript 库,它允许您在网页中创建漂亮的贴纸效果。没有依赖关系(不需要 jQuery),可以在大多数支持 CSS3 的主流浏览器工作。下面有简单的使用示例,更多功能等着你去发现。

  使用示例:

  HTML: 

复制代码 代码如下:




  CSS:

复制代码 代码如下:

.sticker {
width: 180px;
height: 180px;
}
// add image
.example-1 .sticker-img {
background-image: url(heroes-2.png);
}
// add color
.example-2 .sticker-img {
background-color: #ff4a85;
}
// change shadow opacity
.example-2 .sticker-shadow {
opacity: 0.6;
}

  JavaScript: 

复制代码 代码如下:


Sticker.init('.sticker');

  立即下载   在线演示

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn