https://github.com/dafrok/jquery-gift-combo
Gift combo in live.
https://github.com/dafrok/jquery-gift-combo
Last synced: 3 months ago
JSON representation
Gift combo in live.
- Host: GitHub
- URL: https://github.com/dafrok/jquery-gift-combo
- Owner: Dafrok
- License: mit
- Created: 2016-05-03T09:54:52.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-01-23T02:15:22.000Z (over 8 years ago)
- Last Synced: 2025-01-19T09:41:36.182Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 79.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jquery-gift-combo
Gift combo in live.
## Install
```
$ npm i jquery jquery-gift-combo
```
## Usage
### JavaScript
```es6
import $ from 'jquery'
import 'jquery-gift-combo'
let $giftCombo = $('#foo').giftCombo()
let $button = $('#bar')
$button.on('click', function () {
const gifts = 0 | Math.random() * 2 + 1 // create random amounts of gift
$giftCombo.send(gifts)
})
```
### HTML
```html
Gift!
```
### CSS
```css
#gift-combo {
display: inline-block;
}
#gift-combo.gift-combo-active {
animation: gift-combo 0.7s 1;
}
@keyframes gift-combo {
0% {
opacity: 0;
-webkit-transform: scale(1) translateX(-100%);
transform: scale(1) translateX(-100%);
}
50% {
opacity: 1;
-webkit-transform: scale(2) translateX(0);
transform: scale(2) translateX(0);
}
100% {
opacity: 0;
-webkit-transform: scale(1) translateX(100%);
transform: scale(1) translateX(100%);
}
}
```
## Options
```es6
{
// CSS hook
activeClassName: 'active', // default: 'gift-combo-active'
// Life cycle
startCombo: function () {},
oneGift: function () {},
oneCombo: function () {},
allCombo: function () {}
}
```
## API
### send
* `Number` The number of gifts which will be sent.
```es6
$foo.send(5) // default: 1
```