Вывод js скрипта после загрузки страницы
Добрый день! :thanks:
Подскажите пжл (не силен в js): Есть тизер от партнерки. Необходимо его отобразить для мобильных устройств в нижней части экрана. Написал код, он делится на две части: 1) div id='banner' - создает блок внизу моб устройств 2) div id="bclk481" - блок тизера. Но проблема в том, что при загрузке страницы сначала появляется id='banner' c с белым фоном, а спустя 5 и более секунд в нем прогружается тизер. Блок сразу закрывают и получается низкая конверсия ( ctr 0,02%). Хотелось бы, что тизер отображался сразу с блоком(id='banner') - вместе, после загрузки страницы или спустя определенное время (5-10 сек). Пробовал реализовывать через: 1) setTimeout(function()- document.write() },5000); 2) window.onload=function(){} Вставлял код в эти функции, но всегда скрипт падает с фатальной ошибкой. :cray: Подскажите пжл, как это правильно реализовать? Сам код: <div id='banner' style='z-index:1000; position: fixed; bottom:0px; center:0px; width: 100%; height: 20%;'><table border=1 cellspacing=0 cellpadding=0 width=240 style='background-color:#ffffff'><tr><td align=center> <a style='float:right; margin-right: 8%;' href='#' onclick='document.getElementById("banner").style.display="none"'><b>Х</b></a> <br> <div id="bclk481"></div><script type="text/javascript"> (function(w){var l = function() { var n = document.getElementsByTagName("script")[0], s = document.createElement("script"), ins = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "//url.com/next.html?mAVAZHwF33UFl5FRYS9kCIwIZPR8ICwQVUF0"; ins(); }; l(); })(window);</script> </td></tr></table></div> |
dertovs,
изначально скройте 'banner' а в setTimeout откройте |
Сделал, но выдает ошибку, подскажите куда копать:
(index):552 Uncaught TypeError: document.getElementById(...).style is not a function div id='banner' style='z-index:1000; position: fixed; bottom:0px; center:0px; width: 100%; height: 20%; display: none;'><table border=1 cellspacing=0 cellpadding=0 width=240 style='background-color:#ffffff'><tr><td align=center> <a style='float:right; margin-right: 8%;' href='#' onclick='document.getElementById("banner").style.display="none"'><b>Х</b></a> <br> <div id="bclk481"></div><script type="text/javascript"> (function(w){var l = function() { var n = document.getElementsByTagName("script")[0], s = document.createElement("script"), ins = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "//url.com/next.html?xFEU3ChReGhEc44xASUFNX66XNhcMK7odHhEARUg"; ins(); }; l(); })(window);</script> </td></tr></table></div> <script type="text/javascript"> setTimeout(function() {document.getElementById("banner").style("display", "inline");}, 5000); </script> |
Цитата:
document.getElementById("banner").style.display='inline'; |
Цитата:
Все работает |
Часовой пояс GMT +3, время: 16:19. |