Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Smooth scroll div alignment on single page site. Re: Smooth scroll div alignment on single page site.

#112861
JoniGiuro
Participant

I think the problem might be that you’re getting the top() for funding-areas, about-us and our-projects on document ready and maybe those elements are not yet completely loaded and resized. I’d try to move the three variable declarations insite the click function

$(‘#anchor-aboutus’).click(function(event) {
var slowScrollFunding = $(‘#funding-areas’).offset().top;
var slowScrollAbout = $(‘#about-us’).offset().top;
var slowScrollProjects = $(‘#our-projects’).offset().top;