﻿
$(function () {
    var pxShow = 300; //height on which the button will show
    var fadeInTime = 500; //how slow/fast you want the button to show
    var fadeOutTime = 500; //how slow/fast you want the button to hide
    var scrollSpeed = 500; //how slow/fast you want the button to scroll to top. can be a value, 'slow', 'normal' or 'fast'
    $(window).scroll(function () {
        if ($(window).scrollTop() >= pxShow) {
            $(".backtotop").fadeIn(fadeInTime);
        } else {
            $(".backtotop").fadeOut(fadeOutTime);
        }
    });

    $('.backtotop a').click(function () {
        $('html, body').animate({ scrollTop: 0 }, scrollSpeed);
        return false;
    });
});

