Detect shift key while already over element

亡梦爱人 提交于 2019-12-11 10:56:51

问题


Is there any way to detect the shift key being pressed while the mouse is already over a particular element?

Right now, what I have is this:

$( "body" ).on("mouseover", ".topic:not(.loadable) > p", function ( event ){
    if(event.shiftKey){
        this.style.color = 'goldenrod';
    }
});

$( "body" ).on("mouseleave", ".topic:not(.loadable) > p", function ( event ){
    this.style.color = 'black';
});

But it only changes color if the shift key was being held prior to entering the element.

来源:https://stackoverflow.com/questions/23208839/detect-shift-key-while-already-over-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!