jQuery 和预加载图像?
嘿,我是 javascript 的新手,有几个问题。如果我在第 1 页上预加载一堆图像,它们是否会立即在第 2 页上可用?如果 Page-2 通过 jQuery 插件显示这些图像,是否适用相同的规则?谢谢!
Hey there- Semi new to javascript, a couple of questions. If I preload a bunch of images on Page-1, are they then made available in Page-2 instantly? What if Page-2 displays these images via a jQuery plugin, do the same rules apply? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,它们应该在第 2 页上可用,因为例如,如果您预加载导航按钮的翻转状态,则只需在第一次访问网站时预加载它们。然后,图像将被缓存并可供您在同一站点上查看的后续页面使用。
我不确定 jQuery 插件部分。您知道您将使用哪些特定插件吗?
Yes, they should be available on page 2, because if you preload rollover states for navigation buttons, for example, you only need to preload them the first time the site is accessed. The images are then cached and available to subsequent pages you view on the same site.
I'm not sure about the jQuery plugin part. Do you know the specific plugins you'll be using?
我还没有对此进行任何测试,但我想这很大程度上取决于用户如何设置缓存。一般来说,您可以预加载图像,它们将保留在缓存中。有一个漂亮的 html5 功能允许预加载来帮助解决这个问题。
I haven't done any testing on this, but I'd imagine a lot of this depended on how the user had their caching set up. Generally speaking you can pre-load images and they'll remain the cache. There's a nifty html5 feature that allows for pre-loading to help with this as well.