[Solved] when reaching bottom the button should hide [duplicate]


Demo

jQuery

var $window = $(window),
    $document = $(document),
    button = $('.button');

button.css({
    opacity: 1
});

$window.on('scroll', function () {
    if (($window.scrollTop() + $window.height()) == $document.height()) {
        button.stop(true).animate({
            opacity: 0
        }, 250);
    } else {
        button.stop(true).animate({
            opacity: 1
        }, 250);
    }
});

solved when reaching bottom the button should hide [duplicate]