Shift + mouseover with jQuery

前端 未结 4 1256
再見小時候
再見小時候 2021-02-20 13:34

I\'m trying to detect whether the shift key is being pressed while the cursor is moved over a particular element. The function fires, but only after I click on another

4条回答
  •  温柔的废话
    2021-02-20 13:54

    Working sample,

    MouseEvent.shiftKey, MouseEvent.ctrlKey

    MouseEvent.ctrlKey

    MouseEvent.shiftKey

       
    
    
        function keypress_test(event) {
    
                 // false, no press, 
                 // true, pressed
    
                  console.log(event.ctrlKey)
    
                  console.log(event.shiftKey)
           }
    

提交回复
热议问题