Minimal scroll to top

<!-- scroll to top button --> <a href="#" class="scrollToTop btn btn-fab btn-primary"><i class="material-icons">keyboard_arrow_up</i></a> <!-- css codes --> .scrollToTop { position: fixed; right: 30px; bottom: 30px; } .scrollToTop:hover { text-decoration:none; } <!-- script --> $(document).ready(function(){ //Check to see if the window is top if not then display button $(window).scroll(function(){ if ($(this).scrollTop() > 100) { $('.scrollToTop').fadeIn(); } else { $('.scrollToTop').fadeOut(); } }); //Click event to scroll to top $('.scrollToTop').click(function(){ $('html, body').animate({scrollTop : 0},800); return false; }); });
A simple jQuery scroll to top plugin that displays a back to top button at the lower right corner of your current page.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.