【发布时间】:2013-12-28 22:08:34
【问题描述】:
我正在尝试在一个学校项目的网站上设置一个粘性导航栏。这里:http://www.divisionforty.com/aloevera/
我不希望内容位于其下方,我的意思是当它滚动时,内容位于其下方,就像它被定位在绝对位置一样。
希望有人可以帮忙,
丹佛
【问题讨论】:
标签: jquery css twitter-bootstrap sticky-footer
我正在尝试在一个学校项目的网站上设置一个粘性导航栏。这里:http://www.divisionforty.com/aloevera/
我不希望内容位于其下方,我的意思是当它滚动时,内容位于其下方,就像它被定位在绝对位置一样。
希望有人可以帮忙,
丹佛
【问题讨论】:
标签: jquery css twitter-bootstrap sticky-footer
将padding-top 分配给.wrapper 类。如果不想隐藏navbar下的内容,可以给padding-top:100px。请参阅this 示例。
更新:
请给.offset().top -100 100 是您的javascript中导航栏的高度,如下所示:
$("#circlediv").click(function() {
$('html, body').animate({
scrollTop: $("#benefits").offset().top-100
}, 2000);
});
和
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top - 100
}, 1000);
return false;
}
}
});
});
【讨论】: