Difference between revisions of "Template:Team:NUS Singapore/JS"

Line 2,126: Line 2,126:
 
$sidescroll.init();
 
$sidescroll.init();
 
 
 +
});
 +
$(document).ready(function() {
 +
// Show or hide the sticky footer button
 +
$(window).scroll(function() {
 +
if ($(this).scrollTop() > 200) {
 +
$('.go-top').fadeIn(200);
 +
} else {
 +
$('.go-top').fadeOut(200);
 +
}
 +
});
 +
 +
// Animate the scroll to top
 +
$('.go-top').click(function(event) {
 +
event.preventDefault();
 +
 +
$('html, body').animate({scrollTop: 0}, 300);
 +
})
 
});
 
});
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 08:56, 14 October 2016