Jquery顶部面板

Jquery top panel

本文关键字:顶部 Jquery      更新时间:2023-09-26

嘿,伙计们

我有一个问题……我想在我的网站顶部有一个面板,它位于网络浏览器视图的顶部。像这里

http://webeffectual.com/

在这个网站上,即使你滚动浏览网站,顶部面板也会保持在顶部

我的问题是有人能为我指明正确的方向,告诉我如何做到这一点吗?

这是他们在您引用的网站上使用的内容。

具体来说,他们使用'position:fixed;来保持它的位置,使用z-index: 20;来保持它在顶部。

#header {
  background: url("../images/header.png") repeat-x scroll 0 top transparent;
  position: fixed;
  width: 100%;
  z-index: 20;
  height: 116px;
  top: 0;
  margin: 0;
  padding: 0;
}

这应该会让你开始。

不需要javascript。只需使用此css:

#idOfTheBanner { position:fixed;top:0px;}