Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jquery顶部面板_Javascript_Html_Css - Fatal编程技术网

Javascript Jquery顶部面板

Javascript Jquery顶部面板,javascript,html,css,Javascript,Html,Css,嘿,伙计们 我有一个问题是。。。我希望在我的网站顶部有一个面板,它位于web浏览器视图的顶部。像这里 在本网站中,即使您滚动浏览网站,顶部面板仍保持在顶部 我的问题是有人能给我指出正确的方向,或者告诉我怎么做吗?这是他们在你引用的网站上使用的 具体来说,他们使用的是”位置:固定将其保持在原位,并且z-index:20将其保持在顶部 #header { background: url("../images/header.png") repeat-x scroll 0 top transpar

嘿,伙计们 我有一个问题是。。。我希望在我的网站顶部有一个面板,它位于web浏览器视图的顶部。像这里

在本网站中,即使您滚动浏览网站,顶部面板仍保持在顶部


我的问题是有人能给我指出正确的方向,或者告诉我怎么做吗?

这是他们在你引用的网站上使用的

具体来说,他们使用的是
”位置:固定将其保持在原位,并且
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;} 

我的荣幸,瑞安。如果这对您有效,请将其标记为选中,以便其他人知道它已被回答。