Jump to content

How to make a button's function to scroll back to the top of the page

Recommended Posts

  • Replies 6
  • Views 713
  • Created
  • Last Reply

Top Posters In This Topic

right now it reloads the page, but i was hoping for more for of a scroll-to-top effect. like it does on this page when you click the "TOP" button.

thanks!

15 hours ago, tuanphan said:

I see it already scroll to top when click?

 

Link to comment
On 5/31/2024 at 9:03 AM, MWR said:

right now it reloads the page, but i was hoping for more for of a scroll-to-top effect. like it does on this page when you click the "TOP" button.

thanks!

 

Try this code to bottom of Code Injection > Footer

<script>
  $(document).ready(function(){
    $('a#site-title').attr('href','#');
});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
On 6/1/2024 at 11:30 PM, tuanphan said:

Try this code to bottom of Code Injection > Footer

<script>
  $(document).ready(function(){
    $('a#site-title').attr('href','#');
});
</script>

 

Hi again. thanks for sending that over. I pasted that into the code injection and it doesn't seem to do anything. I've left the code in, but is it possible that there's some other code injection that is cancelling it out? any help would be amazing thank you!

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.