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.
我有一些关于js的小游戏。玩游戏时,某些图像会超时加载。如何在启动时通过客户端的浏览器强制预加载所有图像?
与其拥有单独的图像,不如创建一个单独的 sprite 表更好、更高效。使用精灵表,您基本上可以加载一张图像并将其用作精灵/演员的背景图像。然后使用 CSSbackground-position设置显示正确的图像。
background-position
有关使用精灵表的更多信息
精灵表示例
I have used the following code to play a sound:
<object> <param name="autostart" value="true"> <param name="src" value="bgmusic.mp3"> <param name="autoplay" value="t