我制作了一个游戏,并且我使用箭头键移动和空格键进行拍摄,并且每次我按下向下键或空格键时,它都会一直将其压低到网页底部,是否可以将CSS修改为使它专注于游戏div标签而不滚动?
You are failing to cancel the event. If it's an inline event, just return false;
at the end of it. If it's done with addEventListener
, call Event .preventDefault()
and return false;
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.