Scroll Down To Show The Anchor Link To Go To The Top With The Animation

Scroll down to show the anchor link to go to the top with the animation. It is the simplest implementation of a smooth back-to-top functionality using jQuery, JavaScript, and CSS/CSS3.

animated scroll to top button codepen, back to top scroll animation, back to top examples, back to top button pure javascript, scroll to top script, vanilla js back to top

A JavaScript Library to Display Link/URL Preview On Hover | Hyperlinks

How to make use of it:

1. Create an anchor link for the back to top button.

<a href="#myAnchor" class="go-top">
  Icon, Text, Button, etc...
</a>

2. CSS is required to position the back to the top button.

.go-top {
  display: block;
  width: 40px;
  height: 40px;
  line-height: 35px;
  text-align: center;
  font-size: 30px;
  position: fixed;
  bottom: -40px;
  right: 20px;
  -webkit-transition: all 1s ease;
  -moz-transition: all 1s ease;
  -o-transition: all 1s ease;
  transition: all 1s ease;
  background-color: #404040;
  color: #FFFFFF;
  text-decoration: none;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
}

.go-top.show { bottom: 20px; }

.go-top:hover {
  background-color: #5DBA9D;
  color: #FFFFFF;
}

3. Load the required jQuery JavaScript library at the end of the document.

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 

4. Javascript to add/remove CSS classes to back button up when scrolling down/up.

$(window).scroll(function(event){
  var scroll = $(window).scrollTop();
    if (scroll >= 50) {
      $(".go-top").addClass("show");
    } else {
      $(".go-top").removeClass("show");
    }
});

5. Smoothly scroll the window back to the top of your webpage when you click the back-to-top button.

$('a').click(function(){
  $('html, body').animate({
    scrollTop: $( $(this).attr('href') ).offset().top
  }, 1000);
});

Minimal Back To Top Functionality with jQuery and CSS3 Plugin/Github, back to top plugin, back to top smooth scroll jquery


See Demo And Download

Official Website(mattiabericchia): Click Here

This superior jQuery/javascript plugin is developed by mattiabericchia. For extra Advanced Usages, please go to the official website.

Related Posts

Searchable-Select-Dropdown

A Simple Searchable Select Dropdown Plugin | jQuery Select Search

Simple jQuery search on the selection options plugin for your website. Next, there is a checkbox replacement plugin that refines and beautifies the original selection element with…

country-dropdown-with-flags

A Quick jQuery-Based Country Picker With Flags | Country Select JS

Country Select JS is a jQuery plugin to select a country, based on the international phone input plugin. Adds a flag dropdown to any input, which lists…

Autocomplete-and-Typeahead-Javascript-Library

Simple and Fast Autocomplete and Typeahead Javascript Library | autoComplete.js

autoComplete.js is a simple, pure, and incrementally designed JavaScript library for speed, high versatility, and seamless integration with a wide variety of projects and systems. Features Pure…

Bootstrap-Notification-Message-Alert-Plugin

Bootstrap Notification Message Alert Plugin with jQuery

BootstrapMsg is a jQuery plugin for displaying messages with Bootstrap alert classes to generate hierarchical in-page navigation for an extended webpage sectioned by heading components. Using Bootstrap…

jquery-google-chart-plugin

jQuery Plugin for Transforming HTML Tables Into Charts Using Google Charts

Chartinator is a jQuery plugin for converting HTML tables, Google Sheets and js arrays into charts using Google Charts. Use data from HTML tables Chartinator is designed…

free-vue-chart-library

Customizable & Composable Charts for VueJS | vue-wcharts

WCharts is a library that makes it easy to create your own charts using Vuejs. You can easily create reusable chart components. Use a basic layout or…