Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.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
Jquery 如何在屏幕顶部显示通知?_Jquery_Html_Css - Fatal编程技术网

Jquery 如何在屏幕顶部显示通知?

Jquery 如何在屏幕顶部显示通知?,jquery,html,css,Jquery,Html,Css,我想使用,但它总是把通知栏放在页面的顶部。因此,如果页面太大,必须向上滚动到顶部才能看到通知 是否可以让通知始终显示在浏览器窗口的顶部,这样用户就不必向上滚动到页面顶部 这是CSS,如果这是应该改变的地方 /* jQuery Notifications plugin - http://programmingmind.com */ /* notification container */ #jquery-notifications { position: relative; width:

我想使用,但它总是把通知栏放在页面的顶部。因此,如果页面太大,必须向上滚动到顶部才能看到通知

是否可以让通知始终显示在浏览器窗口的顶部,这样用户就不必向上滚动到页面顶部

这是CSS,如果这是应该改变的地方

/* jQuery Notifications plugin - http://programmingmind.com */
/* notification container */
#jquery-notifications {
  position: relative;
  width: 100%;
  left: 0;
  top: 0;
  z-index: 100000;
}
#jquery-notifications p {
  text-align: center;
  position: relative;
  margin: 0;
  padding: 5px;
  padding-left: 10px;
  border-bottom: 2px solid;
  /* style property for the close text */
}
#jquery-notifications p a {
  position: absolute;
  right: 10px;
  margin-right: 10px;
  color: black;
  text-decoration: none;
  border: 1px solid black;
  padding-right: 5px;
  padding-left: 5px;
}
#jquery-notifications .notice {
  background: #6c9ffc;
  color: #061a72;
  border-color: #061a72;
}
#jquery-notifications .success {
  background: #96f96f;
  color: #045419;
  border-color: #045419;
}
#jquery-notifications .warning {
  background: #f7ae57;
  color: #753903;
  border-color: #753903;
}
#jquery-notifications .error {
  background: #f97c6f;
  color: #570f01;
  border-color: #570f01;
}
改变这个

#jquery-notifications {
  position: relative;
  ...
}
…为了这个

#jquery-notifications {
  position: fixed;
  ...
}

固定位置是相对于视口的,而不是相对于文档的。

不知道标记实际如何使用,我无法给出确切的固定位置


但增加
位置:固定到容器(#jquery通知)应使其始终显示在顶部。

确定。它将固定在顶部的位置,用户不需要向上滚动来查看通知,但现在它会出现在顶部的我的网页内容上。我只想它(1)显示在我的网页内容顶部,而不是网页内容(2)当用户关闭此通知时,其他网页内容显示向上移动以填充空间(3)当用户滚动时,它不应隐藏。(与stackoverflow完全相同)