Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ioHandler(entries) {
- for (let entry of entries) {
- entry.target.style.opacity = entry.intersectionRatio.toFixed(2);
- entry.target.addEventListener('click', function(e) {
- if (this.nextElementSibling !== null) {
- this.nextElementSibling.scrollIntoView({
- 'behavior': 'smooth'
- });
- }
- },true);
- if (entry.intersectionRatio > .5) {
- entry.target.classList.add('active')
- } else {
- entry.target.classList.remove('active')
- }
- }
- }
Add Comment
Please, Sign In to add comment