防止 jQuery 精灵平移
添加页面长度

发布于 2024-09-15 08:28:34 字数 439 浏览 5 评论 0原文

由于我对 jQuery spritely 插件方法执行平移 ` 元素,我调用该方法来平移一些超级马里奥兄弟背景,因此它似乎大大增加了页面长度。

如果您访问 http://www.marioplanet.com,您会注意到有 3 种不同的平移背景。仅使用 2,不足以填充页面内容的整个高度,但使用 3 平移时,溢出过多,导致用户能够向下滚动页面,只是为了看到背景平移图像。

我想做的是用页面上最后一个

元素的高度来切断第三次平移,在本例中,我的

关于我如何做到这一点有什么想法吗?我想我总是可以只制作 2 个背景并压缩我的内容,但这并不有趣,不是吗? :)

谢谢!

Since I have a panning ` element do to a jQuery spritely plugin method which I'm calling to pan some Super Mario Bros backgrounds, it appears to increase the page length quite a bit.

If you visit http://www.marioplanet.com you will notice that there 3 different panning backgrounds. With only 2, there isn't enough to fill the entire height of the content of the page, but with 3 panning, there is too much overflow, causing the user to be able to scroll down the page, just to see the background panning image.

What I would like to do, is to cut off the 3rd panning with the height of the last <div> element on my page, in this case, my <div id="footer"> element.

Any ideas on how I can do this? I guess I could always just make 2 backgrounds and squish my content down, but that's no fun, is it? :)

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日久见人心 2024-09-22 08:28:34

我认为最好将背景元素包装在 div 中,并将属性 height(可能还有 min-height)设置为 100%,并将溢出设置为隐藏。如果环绕 div 的高度与内容大小一样小于背景的总高度,则背景将被剪裁。

I think it would be best to wrap your background elements inside a div with the properties height(and possibly min-height) set to 100% and overflow set to hidden. If the wrapping div wich is as high as the content size is smaller than the total height of your backgrounds, the backgrounds will be clipped.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文