问题
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