Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用 jQuery 制作一个小游戏,我想知道是否可以在按下鼠标悬停和/或鼠标输入时触发事件Ctrl?
bindmouseenter和keypressevent 为您希望事情解决的元素。
mouseenter
keypress
$( "#id_of_element" ).bind('mouseenter keypress', function(event) { if (event.ctrlKey)//check if cntrl key is pressed { //your code here } });