2016-06-10 110 views

回答

0

我不知道這是可能防止鼠標移動。

但是,一種方法是跟蹤鼠標的x/y位置,並在用戶離開頁面時提醒用戶。

this SO answer關於鼠標跟蹤。

+0

謝謝我找到了一個方法 – Normurod

2

有一個指針鎖定API,它應該做你在找什麼用canvas.requestPointerLock || canvas.mozRequestPointerLock

有一個演示here

Check out the docs