Jump to content

make a page scroll to the top of each section automatically

Recommended Posts

Site URL: https://calliope-trout-pzeh.squarespace.com/home-scroll

https://calliope-trout-pzeh.squarespace.com/home-scroll

PW: rorymory

Is it possible to make a page scroll automatically to the next section after a few seconds?  

This is what i have in the footer so far:

<script>
$(document).ready(function () {
    var myInterval = false;
    myInterval = setInterval(AutoScroll, 3000);

    function AutoScroll() {
        var myScroll = $(window).scrollTop();
        myScroll = myScroll + 600;
        $('html, body').animate({
            scrollTop: myScroll
        }, 1000);
    }
    
    $(window).scroll(function () {
        var myScroll = $(window).scrollTop();
        if (myScroll == 0) {
            myInterval = setInterval(AutoScroll, 2000);
        }
        if (myScroll + $(window).height() == $(document).height()) {
            clearInterval(myInterval);
        }
    });
});
</script>

but id like it to scroll to each section instead of just moving every three seconds.  

also would it be possible to also have arrows or scroll indicator to override it as well? 

@tuanphan @creedon??

Link to comment
  • Replies 1
  • Views 382
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

On 7/7/2020 at 3:31 PM, tuanphan said:

Can you share link to your site? We can help easier.

or you can try this code

/* footer color */
footer.sections .section-background {
	background: transparent !important;
}
/* footer text color */
footer.sections * {
	color: white !important;
}
/* footer social */
footer.sections * {
	fill: white !important;
	stroke: white !important;
}

 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.