我正在用 jQuery 制作一个小游戏,我想知道按下 Ctrl 时是否可以在悬停和/或 mouseenter 上触发事件?
最佳答案
为您想要解决问题的元素绑定(bind) mouseenter
和 keypress
事件。
$( "#id_of_element" ).bind('mouseenter keypress', function(event) {
if (event.ctrlKey)//check if cntrl key is pressed
{
//your code here
}
});
关于jquery - 你能在 jQuery/javascript 中将 ctrl 和 mouseenter 结合起来吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13152876/