-4

Am set one button on the bottom in jsp page. Using that button the page will scroll down. But i have to hide that button when the page reach bottom. this page is report page. So it contain lot of contents. I have to hide button when reach the bottom of a page. Please help me. am new to jquery

I was not able to found any solution for this.

Here is my code.

 $(window).scroll(function() {
   if ($(window).scrollTop() > ("#bottomScroll")) {
     $("#bottom").addClass('show');
   } else {
     $("#bottom").removeClass('show');
   };
 });
 jscript: function scrollWin() {
   window.scrollBy(0, 180);
 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="button" onclick="scrollWin()">
  <img src="Images/aerodown.png">
</button>
rnrneverdies
  • 15,243
  • 9
  • 65
  • 95
eThan_hunT
  • 244
  • 5
  • 23

1 Answers1

1

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);
    }
});
4dgaurav
  • 11,360
  • 4
  • 32
  • 59