| 1 |
wp.domReady(function () { |
| 2 |
document.querySelectorAll('.bkbg-fsc-wrapper').forEach(function (wrapper) { |
| 3 |
var rows = wrapper.querySelectorAll('.bkbg-fsc-row.bkbg-fsc-anim'); |
| 4 |
if (!rows.length) return; |
| 5 |
|
| 6 |
var io = new IntersectionObserver(function (entries) { |
| 7 |
entries.forEach(function (entry, idx) { |
| 8 |
if (entry.isIntersecting) { |
| 9 |
setTimeout(function () { |
| 10 |
entry.target.classList.add('bkbg-fsc-visible'); |
| 11 |
}, idx * 120); |
| 12 |
io.unobserve(entry.target); |
| 13 |
} |
| 14 |
}); |
| 15 |
}, { threshold: 0.12 }); |
| 16 |
|
| 17 |
rows.forEach(function (row) { io.observe(row); }); |
| 18 |
}); |
| 19 |
}); |
| 20 |
|