Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function(){
- const pagination = document.querySelector('.collection__pagination');
- if (!pagination) return;
- // Создаем наблюдателя
- const observer = new IntersectionObserver((entries) => {
- entries.forEach(entry => {
- if (entry.isIntersecting) {
- // Находим кнопку внутри блока
- const loadButton = pagination.querySelector('.collection__pagination-button-load');
- if (loadButton) {
- loadButton.click();
- }
- }
- });
- }, {
- root: null, // viewport
- threshold: 0.1 // срабатывает, когда хотя бы 10% блока видны
- });
- observer.observe(pagination);
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment