A X-Tag element for handling keyboard shortcuts & gestures, backed by Hammer.js and Mousetrap.
Maintained by Gianni Furger.
Install with Bower:
$ bower install --save x-tag-trap
-
Import Web Components' polyfill:
<script src="dist/x-tags-components.js"></script>
-
Import
hammer.js
to handle gestures:<script src="dist/hammer.min.js"></script>
-
Import
mousetrap.js
to handle keyboard shortcuts:<script src="dist/mousetrap.min.js"></script>
-
Import Custom Element:
<script src="dist/trap.js"></script>
-
Start using it!
<x-trap></x-trap>
<x-trap keys="a space command" action="window.open('http://spacecommandmusic.com');"></x-trap>
In order to run it locally you'll need a basic server setup.
-
Install Node.js
-
Install Grunt:
$ npm install --global grunt-cli
-
Install Bower
-
Install local dependencies:
$ npm install && bower install
-
Run a local server and open
http://localhost:3001
.$ grunt connect
Attribute | Options | Default | Description |
---|---|---|---|
keys |
string | `` | Keys |
gestures |
string | `` | Gestures |
action |
string/function | function(){} |
Action |
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
For detailed changelog, check Releases.