I'm currently developing a website for an university course (Link: http://ift.tt/2jmwPot) and there's an issue I'm not able to solve on my own. I have a "back-to-top" button. With jQuery it lets the page scroll up smoothly.
HTML
<a id="back-to-top" href="#"><i class="fa fa-chevron-circle-up" aria-hidden="true"></i></a>
The following code in my script.js file works fine on the homepage of my website. Unfortunately this doesn't work on any of my subpages.
jQuery
$("#back-to-top").click(function(e){
e.preventDefault();
$("html, body").animate({scrollTop: "0"});
});
Do you have any suggestions? Thanks so much in advance!
Aucun commentaire:
Enregistrer un commentaire