emoji claps
v0.1.7
鼓掌的体验成瘾元素? / 喜欢? / 不喜欢? 。
是的,您可以click
并hold
以增加数量。在 Codepen 上尝试一下!
$ yarn add emoji-claps // ES module
或在浏览器中
< script src =" https://unpkg.com/emoji-claps/dist/emoji-claps.umd.js " > </ script >
<!-- It's umd bundle-->
动画使用Element.animate
方法和effect.target
,它很奇特且命令式,但不完全支持低版本浏览器和 Safari,因此请在初始之前运行下一个web-animation next
polyfill。
< script src =" https://rawgit.com/web-animations/web-animations-js/master/web-animations-next-lite.min.js " > </ script >
< emoji-claps
emoji =" ? "
currentcount =" 30 "
maxcount =" 50 "
bullets =' ["?","?","","?"] '
bulletcount =" 6 "
prefix =" + "
> </ emoji-claps >
当currentcount === maxcount
时, full
事件将触发。
举个例子
const emojiClaps = document . querySelector ( 'emoji-claps' ) ;
emojiClaps . addEventListener ( 'full' , e => {
// Do something if currentcount is 50 (maxcount)
} )
当用户点击emoji-claps
时,将触发click
事件。
举个例子
const emojiClaps = document . querySelector ( 'emoji-claps' ) ;
emojiClaps . addEventListener ( 'click' , e => {
// Do something track after user click
} )
许可 MIT © 2019 realdennis