()
| 5 | checkBoxes() |
| 6 | |
| 7 | function checkBoxes(){ |
| 8 | const triggerBottom = window.innerHeight / 5 * 4 |
| 9 | |
| 10 | boxes.forEach(box => { |
| 11 | const boxTop = box.getBoundingClientRect().top |
| 12 | |
| 13 | if(boxTop < triggerBottom){ |
| 14 | box.classList.add('show') |
| 15 | }else{ |
| 16 | box.classList.remove('show') |
| 17 | } |
| 18 | }) |
| 19 | } |