我正在尝试模拟全屏游戏的点击,例如 shellshock.io 或narrow.one(我正在尝试做的游戏)。我该如何用 javascript 做到这一点?
如果可以的话,你能在游戏中模拟按键吗?
请尝试以下。
<div class="fullScreenElement">
...
<button id="elementYouWantToClick">Example</button>
...
</div>
document.getElementById('elementYouWantToClick').click(); // make sure this el is within the fullscreen element