I'm trying to build a new trendy one page website where I scroll to a section on the page. I want to bring the "fixed" header to exactly where the content is. I am using the Zurb Foundation. This is what I have so far (some of the code found here):
<li><%= link_to "Recent Work", "#", "data-scroll" => "recent" %></li>
$(document).ready(function() {
$("a[data-scroll]").click(function() {
var id = $(this).data("scroll")
$('html,body').animate({
scrollTop: $("#"+id).offset().top},
'slow');
});
});
<div id="recent">some content</div>
Problem I have is stated above. I want to bring my fixed header to exactly where this div is placed on the page. Please advise.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…