---
# System prepended metadata

title: jQuery-SlotMachine 使用筆記
tags: [JavaScript, js]

---

jQuery-SlotMachine 使用筆記
===
###### tags: `JavaScript` `js`

功能說明
:::info
輕量化的 js 老虎機套件
:::

## 安裝
```bash=
npm install jquery-slotmachine --save
```
## 引用
```htmlmixed=
<script src="./node_modules/jquery-slotmachine/dist/slotmachine.min.js"></script>
```

## 測試
```htmlmixed=
<div id="machine">
        <div>馬德里</div>
        <div>倫敦</div>
        <div>紐約</div>
    </div>

    <script>
        const el = document.querySelector('#machine');
        const machine = new SlotMachine(el, {
            active: 1,
            delay: 450,
            auto: 1500
        });
    </script>
```

![](https://i.imgur.com/jQY5HDZ.png)


## 參考資料
[js抽奖插件jQuery-SlotMachine](http://www.jq22.com/jquery-info21724)
