作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这里有一个关于如何制作漂亮的 jQuery Twitter 风格警报的优秀代码示例:
http://blog.codecrate.com/2009/10/twitter-style-alerts-in-rails.html
$(function () {
var alert = $('.alert');
if (alert.length > 0) {
alert.show().animate({height: alert.outerHeight()}, 200);
window.setTimeout(function() {
alert.slideUp();
}, 3000);
}
});
但是,代码未包含的一件事是将警报 div 粘贴到窗口顶部的功能,无论用户向下滚动页面多远。
我找到了一些例子,但似乎没有什么能很好地与现有代码一起使用。
有什么想法吗?
最佳答案
您可以使用 CSS 样式:position: fixed
虽然我认为 IE 对此有一些问题(不足为奇......)。
关于javascript - 如何使 Twitter 样式的警报贴在窗口顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2616477/
我在获取附加 Bootstrap 导航栏以在页面滚动时正确调整其宽度时遇到问题。 我希望导航栏在页面滚动时保持其包含元素内部的宽度,或者占据页面的整个宽度(从左到右开始) 我做错了什么,或者我需要做什
所以我正在尝试创建一个布局,其中我有一个带有卡片的页面,右侧有一张摘要卡片,在我滚动时会 float 。一种典型的词缀对象,以前在 bootstrap 中见过。到目前为止,这是我的尝试: 出于某种原因
我是一名优秀的程序员,十分优秀!