Questions tagged [mousetrap]

Mousetrap is a JavaScript library for handling keyboard shortcuts

Official Links

36 questions
0
votes
2 answers

Wordpress Attachment Page Navigate with Keyboard

I'm using WordPress. I want to navigate my attachment page with left and right key. Here is my codes, but not working; function GoToLocation(url) { window.location = url; } Mousetrap.bind("j", function() { //alert('j pressed'…
ceylankral
  • 38
  • 9
0
votes
1 answer

Detect primary button of `?` character

I'm using Mousetrap to detect the press of alt + / Actually I'm doing so because I'm interested to the alternative character printed on the / button (the ?) If for an user using english keyboard (or any keyboard with ? assigned as secondary action…
Fez Vrasta
  • 14,110
  • 21
  • 98
  • 160
0
votes
1 answer

React JS call function within another component

I'm trying to call one function from another component in React with the Mousetrap library. class Parent extends React.Component { constructor() { super(); } ... render() { return(...); } } class Child extends…
Cassidy
  • 3,328
  • 5
  • 39
  • 76
0
votes
1 answer

Prevent keypress to bubble to input in mousetrap

I am using mousetrap for capturing key presses. One of the shortcuts I want to define is to focus on an input. Mousetrap.bind('i', function() { $('.input').focus() }); The focussing works fine, but the 'i' keypress also gets bubbled to the input,…
Vishesh Joshi
  • 1,601
  • 2
  • 16
  • 32
0
votes
1 answer

Why is 'keydown'/'keyup' not triggering on the first key press?

I have a sprite that animates on the x-axis via the left and right arrow keys. It is setup to move on 'keydown' and stop on 'keyup'. The problem is, it only animates after the second key press. I've also tried holding down either left or right keys…
0
votes
3 answers

jQuery plugin to extend on() function doesn't accept "this"

I'm writing a plugin to extend the on() function of jQuery to implement mousetrap.js I should get from the function this and pass it to on(). This is my code: $.fn.superon = function (keys, myfn) { $("body").on("click", this, function…
Fez Vrasta
  • 14,110
  • 21
  • 98
  • 160
1 2
3