How to show content when the page is scrolled?

Asked 3 years ago 205 views 1 answer Modified 7 hours ago
14
I want to create a scroll-triggered animation where a div element becomes visible when the user scrolls down to a certain percentage of the page (like 10% or 50%). How can I implement this functionality using JavaScript? I'd prefer a solution that works with vanilla JavaScript or jQuery.
shama-naaz
50 reputation

1 Answer

0
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! ```javascript ``` In this example, when the user scrolls 400 pixels down, the element with id="id" will become visible. Adjust the scroll value (400) based on your requirements.
imran-nadwi
answered 3 years ago
You can use Markdown to format your answer.
Last edited: 3 years ago
Preview: