scroll top custom icon animation - Download Scroll To Top Button With Custom Icon & Animation - back-to-top.js

Download Scroll To Top Button With Custom Icon & Animation – back-to-top.js

Posted on

This time I will share jQuery Plugin and tutorial about Scroll To Top Button With Custom Icon & Animation – back-to-top.js, hope it will help you in programming stack.

scroll top custom icon animation - Download Scroll To Top Button With Custom Icon & Animation - back-to-top.js
File Size: 5.05 KB
Views Total: 4174
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

back-to-top.js is a small jQuery plugin to create a custom scroll to top button that animates scrolling to the top of the page when clicked.

Auto hides when on top and auto reveals on scroll.

How to use it:

1. Load the Stylesheet jquery.back-to-top.css and JavaScript jquery.back-to-top.js in your HTML document.

1 <link rel="stylesheet" href="jquery.back-to-top.css">
3         integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" 
4         crossorigin="anonymous"></script>
5 <script src="jquery.back-to-top.js"></script>

2. Load an icon font of your choice for the back to top icon. Default: Font Awesome.

1 <link rel="stylesheet"
3       integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
4       crossorigin="anonymous">

3. Create an empty a link for the back to top icon.

1 <a href="#" class="bck"></a>

4. Initialize the plugin to generate a default back to top button.

1 $(function(){
2  
3   $('.bck').backToTop();   
4  
5 });

5. Customize the back to top icon.

1 $('.bck').backToTop({
2   iconName: 'fas fa-chevron-up'
3 });   

6. Set the distance from the top to reveal the back to top button on scroll.

1 $('.bck').backToTop({
2   trigger : 300
3 });   

7. Customize the show/hide animations for the back to top button.

01 $('.bck').backToTop({
02  
03   // 'rightToLeft', 'leftToRight'
04   // 'bottomToTop', 'topToBottom '
05   fxName : 'fade',
06  
07   // duration of animation
08   fxTransitionDuration : 300
09    
10 });      

8. Set the duration of the scroll animation.

1 $('.bck').backToTop({
2   scrollDuration : 300
3 });   

This awesome jQuery plugin is developed by axelco. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net