You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TheMechanic edited this page Apr 27, 2015
·
2 revisions
Welcome to the mickey.js wiki!
Mickey for the apps
If you need to use this script in your apps, you need to know some more things.
It is necessary to grab the keys used for the navigation. Otherwise, an error "cannot move" will be thrown.
In the following sample, don't forget to import lodash.js, r7extlib.js, and mickey.js scripts in the head markups.
Example
<body><divid="main"><uldata-nav-area="li"><li>item 1</li><li>item 2</li><li>item 3</li><li>item 4</li></ul></div></body><script>varmickey=newMickey(document.getElementById('main')).init();// moveR7.grabKey('Up',function(e){mickey.move('up');});R7.grabKey('Right',function(e){mickey.move('right');});R7.grabKey('Down',function(e){mickey.move('down');});R7.grabKey('Left',function(e){mickey.move('left');});// other keys...R7.grabKey('Enter',function(){apps.onKeyEnter();});
...
</script>