0
我試圖捕獲事件,如果按下鍵'H'並且鼠標正在移動某個div。當某個按鍵被按下時,jquery捕獲mousemove
的keyPressed和mouseMoving都必須是真實的
https://jsfiddle.net/bababalcksheep/1Loeh2pn/
代碼:
$('#header').on("mousemove keydown", function(e) {
//only print if key 'H' is pressed and mouse is moving over $('#header')
if (e.type === 'mousemove' && e.which === 72) {
console.log('working');
}
});
我注意到我必須點擊div來觸發懸停..如預期正常工作 – django