How to show content when the page is scrolled?
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.
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.