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.
我有这个元素在一个mouseup函数上动画,但现在,它适用于左右按钮。有没有办法只使用左键?
mouseup
$(document).ready(function() { $("div").mouseup(function() { top: "-101%" }); });
您可以检查使用哪个鼠标按钮按下e.which(1主要,2中间和3次要):
e.which
1
2
3
$(document).ready(function() { $("div").mouseup(function(e) { if (e.which != 1) return false; // Stops all non-left-clicks ... }); });