How to show content when screen is scrolled?

#16
51
1 Answer
Question Image

I want to show a div when the screen is scrolled 10% or 50%, tell me how this is possible with javascript?


Related to:
screenscrollshowhidejavascript
0
Answer
Answer 1 of 1
# 3

To show content when screen is scrolled.

Use CSS property  display: none; and display: block; or use visibility: hidden; and visibility: visible;.

Choose either method depending on your requirement.

This can be done using JQuery!

<script>
    $(window).scroll(function() {
  if ($(window).scrollTop() >= 400) {
 $("#id").css("display""block");
        } else {
 $("#id").css("display""none");
      }
  });
</script>

Try this.

0
0
0
Related Articles

If you still have a question about this, submit it in our Q&A community - Ask Question