You are viewing an old revision of this post, from January 26, 2022 @ 16:41:22. See below for differences between this version and the current revision.

jQuery – Show and hide Div on scroll

If you have a div that sits at the bottom of a slideshow that you want to disappear when the user scrolls down, and then reappears when scrolls back to the top, you can follow the below example.
<div>
  <div class="a">
    A
  </div>
</div>​


$(window).scroll(function() {
  if ($(this).scrollTop() > 0) {
    $('.a').fadeOut();
  } else {
    $('.a').fadeIn();
  }
});
  Hope it is useful for someone 🙂

Revisions

  • January 26, 2022 @ 16:41:22 [Current Revision] by Sharing Solution
  • January 26, 2022 @ 16:41:22 by Sharing Solution

Revision Differences

There are no differences between the January 26, 2022 @ 16:41:22 revision and the current revision. (Maybe only post meta information was changed.)

No comments yet.

Leave a Reply