Posted inJavaScript / CSS / jQuery / Programming

Create Scroll Back to Top Button using jQuery and CSS

Create Scroll Back to Top Button using jQuery and CSS

Welcome on Pakainfo.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Create Scroll Back to Top Button using jQuery and CSS

In this post we will show you Best way to implement Creating a smooth scroll “Back to Top” button using jQuery, hear for How to Create Floating Back to Top Button with jQuery with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

HTML markup Part(index.html)

Clcik here to Scroll ↓

JavaScript Part (index.js)

if ($('#live-back-top').length) {
    var scrollTrigger = 100, // px
        backToTop = function () {
            var scrollTop = $(window).scrollTop();
            if (scrollTop > scrollTrigger) {
                $('#live-back-top').addClass('show');
            } else {
                $('#live-back-top').removeClass('show');
            }
        };
    backToTop();
    $(window).on('scroll', function () {
        backToTop();
    });
    $('#live-back-top').on('click', function (e) {
        e.preventDefault();
        $('html,body').animate({
            scrollTop: 0
        }, 700);
    });
}

Style Part (style.css)

#live-back-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 9999;
    width: 32px;
    height: 32px;
    text-align: center;
    line-height: 30px;
    background: #f5f5f5;
    color: #444;
    cursor: pointer;
    border: 0;
    border-radius: 2px;
    text-decoration: none;
    transition: opacity 0.2s ease-out;
    opacity: 0;
}
#live-back-top:hover {
    background: #e9ebec;
}
#live-back-top.show {
    opacity: 1;
}
#content {
    height: 2000px;
}

Example

I hope you have Got Customizable Back To Top Button with jQuery – backTop And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype