浮动底栏移动时出现抖动

发布于 2024-08-03 00:19:06 字数 1757 浏览 2 评论 0原文

我创建了一个带有浮动栏的页面。问题是,当我移动右侧的滚动条时,浮动的底部栏正在不稳定地移动,尽管它最终位于底部。

我尝试通过删除背景身体图像或删除 container-msgoverflow:auto 来修复抖动问题。它有效,但我需要把它们打开。我该怎么做才能让这个动作顺利进行?

HTML 是:

<body style="background:#cfe1ed url(bg.jpg) repeat-x fixed;margin: 0;padding: 0;text-align: center;color: #404040;font-family: Tahoma, Geneva, sans-serif;font-size: 12px;">
<div id="container-msg" style="width: 900px;min-height: 500px;border: 0;overflow:auto;text-align: left;margin: 0 auto 0 auto;background:#FFF;">
  <p>h</p>
  <p>dfh</p>
  <p>h</p>
  <p>fg</p>
  <p>hf</p>
  <p>h</p>
  <p>g</p>
  <p>dfg</p>
  <p>dfh</p>
  <p>fg</p>
  <p>hfg</p>
  <p>h</p>
  <p>fgh</p>
  <p>fgh</p>
  <p>gfh</p>
  <p>fh</p>
  <p>dg</p>
  <p>h</p>
  <p>dfh</p>
  <p>h</p>
  <p>fg</p>
  <p>hf</p>
  <p>h</p>
  <p>g</p>
  <p>dfg</p>
  <p>dfh</p>
  <p>fg</p>
  <p>hfg</p>
  <p>h</p>
  <p>fgh</p>
  <p>fgh</p>
  <p>gfh</p>
  <p>fh</p>
  <p>dg</p>
  <p>h</p>
  <p>dfh</p>
  <p>h</p>
  <p>fg</p>
  <p>hf</p>
  <p>h</p>
  <p>fghf</p>
  <p>h</p>
</div>
<div id="music" style=" background:#CCC;display:block;position:fixed;height:35px;width:500px;bottom:0px;margin-left:auto;margin-right:auto;
">
</div>

</body>

I created a page with a floating bar. The problem is that when I move the scroll bar on the right, the floating bottom bar is moving jerkily although it eventually is at bottom.

I tried to fix the jerky movement by either removing the background body image or removing the overflow:auto for container-msg. It works but I need to have those on. What can I do to make this movement smooth?

The HTML is:

<body style="background:#cfe1ed url(bg.jpg) repeat-x fixed;margin: 0;padding: 0;text-align: center;color: #404040;font-family: Tahoma, Geneva, sans-serif;font-size: 12px;">
<div id="container-msg" style="width: 900px;min-height: 500px;border: 0;overflow:auto;text-align: left;margin: 0 auto 0 auto;background:#FFF;">
  <p>h</p>
  <p>dfh</p>
  <p>h</p>
  <p>fg</p>
  <p>hf</p>
  <p>h</p>
  <p>g</p>
  <p>dfg</p>
  <p>dfh</p>
  <p>fg</p>
  <p>hfg</p>
  <p>h</p>
  <p>fgh</p>
  <p>fgh</p>
  <p>gfh</p>
  <p>fh</p>
  <p>dg</p>
  <p>h</p>
  <p>dfh</p>
  <p>h</p>
  <p>fg</p>
  <p>hf</p>
  <p>h</p>
  <p>g</p>
  <p>dfg</p>
  <p>dfh</p>
  <p>fg</p>
  <p>hfg</p>
  <p>h</p>
  <p>fgh</p>
  <p>fgh</p>
  <p>gfh</p>
  <p>fh</p>
  <p>dg</p>
  <p>h</p>
  <p>dfh</p>
  <p>h</p>
  <p>fg</p>
  <p>hf</p>
  <p>h</p>
  <p>fghf</p>
  <p>h</p>
</div>
<div id="music" style=" background:#CCC;display:block;position:fixed;height:35px;width:500px;bottom:0px;margin-left:auto;margin-right:auto;
">
</div>

</body>

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

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

发布评论

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

评论(1

仅冇旳回忆 2024-08-10 00:19:06

它似乎工作得很好。但是,请确保添加有效的文档类型,否则position:fixed 将无法在 IE7 中工作。对于 IE6,您每次都必须编写一小段 JavaScript 代码来将其向下移动。

It appears to be working perfectly fine. However, make sure you add a VALID doctype else position:fixed will NOT work in IE7. For IE6, you will have to write a small javascript code to move it down each and every time.

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