Advertisement
clickio

Mirror-sticky

Mar 24th, 2020
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.98 KB | None | 0 0
  1. <style>
  2.     #maincenter {
  3.         overflow: visible !important;
  4.         position: relative;
  5.     }
  6.     .lx_fixed_left_wrapper, .lx_fixed_right_wrapper {
  7.         position: absolute;
  8.         top: 21px; /* Верхний отступ */
  9.         width: 160px; /* Ширина блока */
  10.     }
  11.     .lx_fixed_left_wrapper{
  12.         left: -174px; /* Отступ левого wrapper-а относительно элемента контента */
  13.     }
  14.     .lx_fixed_right_wrapper {
  15.         right: -174px; /* Отступ правого wrapper-а */
  16.     }
  17. </style>
  18. <script>
  19. (function(){
  20.         // Селектор элемента с контентом, относительно которого будут выравниваться рекламные блоки
  21.         var content = document.querySelector('#maincenter');
  22.    
  23.         // Коды рекламных блоков
  24.         var codeLeft = "<scr"+"ipt async type='text/javascript' src='//s.clickiocdn.com/t/common_258.js'></scr"+"ipt>" +
  25.             "<scr"+"ipt class='__lxGc__' type='text/javascript'>" +
  26.             "((__lxGc__=window.__lxGc__||{'s':{},'b':0})['s']['_205278']=__lxGc__['s']['_205278']||{'b':{}})['b']['_603177']={'i':__lxGc__.b++};" +
  27.             "</scr"+"ipt>";
  28.         var codeRight = "<scr"+"ipt async type='text/javascript' src='//s.clickiocdn.com/t/common_258.js'><\/scr"+"ipt>" +
  29.             "<scr"+"ipt class='__lxGc__' type='text/javascript'>" +
  30.             "((__lxGc__=window.__lxGc__||{'s':{},'b':0})['s']['_205278']=__lxGc__['s']['_205278']||{'b':{}})['b']['_661438']={'i':__lxGc__.b++};" +
  31.             "</scr"+"ipt>";
  32.  
  33.     function addSide(code, side, container){
  34.         var absDiv = document.createElement('div');
  35.         absDiv.classList.add('lx_fixed_' + side + '_wrapper');
  36.         content.appendChild(absDiv);
  37.         var div = document.createElement('div');
  38.         div.innerHTML = code;
  39.         absDiv.appendChild(div);
  40.         while (div.firstChild) absDiv.insertBefore(div.firstChild, div);
  41.         absDiv.removeChild(div);
  42.         var scripts = absDiv.getElementsByTagName("script");
  43.         Array.from(scripts).forEach(function(script, index, array) {
  44.             var newScript = document.createElement('script');
  45.             if(typeof script.src !== "undefined" && script.src && script.sr !== "")
  46.            {
  47.                newScript.src = script.src;
  48.                 newScript.className = script.className;
  49.                 absDiv.appendChild(newScript);
  50.             }
  51.             else
  52.             {
  53.                 var data = (script.text || script.textContent || script.innerHTML || "");
  54.                 newScript.className = script.className;
  55.                 newScript.type = script.type;
  56.                 newScript.appendChild(document.createTextNode(data));
  57.                 absDiv.appendChild(newScript);
  58.             }
  59.             absDiv.removeChild(script);
  60.         });
  61.     }
  62.  
  63.     addSide(codeLeft, 'left', content);
  64.     addSide(codeRight, 'right', content);
  65. })();
  66.  
  67. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement