JQuery or [removed] How determine if shift key being pressed while clicking anchor tag hyperlink?

前端 未结 12 2030
别那么骄傲
别那么骄傲 2020-11-27 03:00

I have an anchor tag that calls a JavaScript function.

With or without JQuery how do I determine if the shift key is down while the link is clicked?

The foll

12条回答
  •  遥遥无期
    2020-11-27 03:31

    This works great for me:

    function listenForShiftKey(e){
        var evt = e || window.event;
        if (evt.shiftKey) {
          shiftKeyDown = true;
        } else {
          shiftKeyDown = false;
        }
    }
    

提交回复
热议问题