Detect shift key when already over element

Is there a way to detect when the shift key is pressed while the mouse is already over a certain element?

I now have the following:

$( "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 change key was held down before the item was entered.

+1


source to share





All Articles