function isScrolledIntoView(elem) { var docViewTop = jQuery(window).scrollTop(); var docViewBottom = docViewTop + jQuery(window).height(); var elemTop = jQuery(elem).offset().top; var elemBottom = elemTop + jQuery(elem).height(); return ( (elemTop <= docViewBottom) && (elemTop >= docViewTop) || (elemBottom <= docViewBottom) && (elemBottom >= docViewTop) ); } jQuery('#our_a_bottom').html('
');function renderABottom() { window.yaContextCb.push(()=>{ Ya.Context.AdvManager.render({ blockId: 'R-A-645045-3', renderTo: 'yandex_rtb_R-A-645045-3' }) }); } renderABottom(); setInterval(function(){ if (isScrolledIntoView('#yandex_rtb_R-A-645045-3')) { console.log('Reload bottom block'); renderABottom(); } }, 30000); (function(w, d, c, s, t){ w[c] = w[c] || []; w[c].push(function(){ gnezdo.create({ tizerId: 46082, containerId: 'containerId46082' }); }); })(window, document, 'gnezdoAsyncCallbacks');