Advertisement
clickio

cs.abcdef.wiki Adfox sticky codes

Aug 26th, 2021 (edited)
1,332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5.98 KB | None | 0 0
  1. в head
  2.  
  3. <script>window.yaContextCb = window.yaContextCb || []</script>
  4. <script src="https://yandex.ru/ads/system/context.js" async></script>
  5.  
  6. _________________________
  7.  
  8. в body
  9.  
  10. <!-- 320x100-->
  11. <!-- CLICKIO AdFox unit 679590 -->
  12. <div id="lx_sticky">
  13.     <div id="lx_noclick"></div>
  14.     <button id="lx_close_button"></button>
  15.     <div id='adfox_162819537282752203'></div>
  16. </div>
  17. <script>
  18.     (function(w, n) {
  19.     window.yaContextCb.push(()=>{
  20.         Ya.adfoxCode.createScroll({
  21.                 ownerId: 257193,
  22.             containerId: 'adfox_162819537282752203',
  23.                 params: {
  24.                     pp: 'ksq',
  25.                 ps: 'fcnb',
  26.                 p2: 'fpxb'
  27.                 }
  28.             },
  29.         ['phone'],
  30.         {
  31.           tabletWidth: 1024,
  32.           phoneWidth: 767,
  33.           isAutoReloads: true
  34.         })
  35.     })
  36. </script>
  37. <style>
  38.     :root {
  39.         --lx-bg-color: #fff;
  40.         --lx-cross-color: #000;
  41.     }
  42.  
  43.     #lx_sticky {
  44.         width: 100%;
  45.         max-height: 104px;
  46.         padding-top: 4px;
  47.         z-index: 2147483647;
  48.         position: fixed;
  49.         bottom: 0px;
  50.         background: var(--lx-bg-color);
  51.         text-align: center;
  52.         transition: 300ms ease-in;
  53.         line-height: 0px;
  54.         box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2) !important;
  55.     }
  56.  
  57.     #lx_sticky #lx_close_button {
  58.         position: absolute;
  59.         width: 44px;
  60.         height: 30px;
  61.         top: -30px;
  62.         left: 0px;
  63.         background-size: 13px 13px;
  64.         background-position: 9px;
  65.         background-color: var(--lx-bg-color);
  66.         background-repeat: no-repeat;
  67.         box-shadow: 0 -1px 1px 0 rgba(0, 0, 0, 0.2);
  68.         border: none;
  69.         border-radius: 0 12px 0 0;
  70.         outline: none;
  71.         font-family: verdana;
  72.         font-size: 0px;
  73.         color: var(--lx-cross-color);
  74.     }
  75.  
  76.     #lx_sticky #lx_close_button:before {
  77.       content: "";
  78.       display: inline-block;
  79.       width: 10px;
  80.       height: 10px;
  81.       transform: rotate(-45deg);
  82.       border-left: 2px solid var(--lx-cross-color);
  83.       border-bottom: 2px solid var(--lx-cross-color);
  84.       position: relative;
  85.       top: -3px;
  86.     }
  87.     #lx_sticky #lx_close_button span {
  88.       width: 28px;
  89.       height: 28px;
  90.       line-height: 28px;
  91.       text-align: center;
  92.       display: block;
  93.       position: relative;
  94.       color: var(--lx-cross-color);
  95.       z-index: 1;
  96.     }
  97.  
  98.     #lx_sticky #lx_noclick {
  99. position: absolute;
  100.     top: -55px;
  101.     left: 0px;
  102.     height: 85px;
  103.     width: 66px;
  104.     }
  105. </style>
  106. <script>
  107.     (function(){
  108.         var lxAdUnit      = document.querySelector("#lx_sticky");
  109.         var lxCloseButton = document.querySelector("#lx_close_button");
  110.  
  111.         function lxCloseUnit() {
  112.             while (lxAdUnit.hasChildNodes()) {
  113.                 lxAdUnit.removeChild(lxAdUnit.lastChild);
  114.             }
  115.         }
  116.  
  117.         lxCloseButton.onclick = lxCloseUnit;
  118.  
  119.         var noClick = document.querySelector("#lx_sticky #lx_noclick");
  120.  
  121.         function lxNoClickHndlr(e) {
  122.             e.preventDefault();
  123.             e.stopPropagation();
  124.             return false;
  125.         }
  126.  
  127.         noClick.addEventListener("click", lxNoClickHndlr);
  128.        
  129.     })();
  130. </script>
  131.  
  132.  
  133. <!-- CLICKIO AdFox unit 679588 -->
  134. <script>
  135.     document.addEventListener("DOMContentLoaded", function(event) {
  136.         var Sticky = (function() {
  137.             var CSS_CLASS_ACTIVE = 'is-fixed';
  138.             var Sticky = {
  139.               element: null,
  140.               position: 0,
  141.               addEvents: function() {
  142.                   window.addEventListener('scroll', this.onScroll.bind(this));
  143.               },
  144.               init: function(element, end) {
  145.                   this.element = element;
  146.                   this.addEvents();
  147.                   this.position = element.getBoundingClientRect().top + pageYOffset;;
  148.                   this.onScroll();
  149.               },
  150.               aboveScroll: function() {
  151.                   return this.position < window.pageYOffset;
  152.              },
  153.              underScroll: function() {
  154.                return end.getBoundingClientRect().top + pageYOffset <= window.pageYOffset + this.element.getBoundingClientRect().height;
  155.              },
  156.              onScroll: function(event) {
  157.                  if (this.aboveScroll() == true && this.underScroll() == false) {
  158.                      this.setFixed();
  159.                  } else {
  160.                      this.setStatic();
  161.                  }
  162.              },
  163.              setFixed: function() {
  164.                  this.element.classList.add(CSS_CLASS_ACTIVE);
  165.                  this.element.style.position = 'fixed';
  166.                  this.element.style.top = "10px";
  167.              },
  168.              setStatic: function() {
  169.                  this.element.classList.remove(CSS_CLASS_ACTIVE);
  170.                  this.element.style.position = 'relative';
  171.                  this.element.style.top = 0;
  172.              }
  173.          };
  174.              return Sticky;
  175.        })();
  176.  
  177.  
  178.        // Запускаем прилипание для элементов на странице
  179.        // sticky -- элемент, который будет "прилипать" к верху
  180.        var sticky = document.querySelector('#adfox_162819431226251126');
  181.        // end -- элемент перед которым "прилипание будет сбрасываться"
  182.        var end = document.querySelector('#mw-body');
  183.        if (sticky)
  184.            Sticky.init(sticky, end);
  185.    });
  186. </script>
  187. <div id="adfox_162819431226251126"></div>
  188. <script>
  189.     window.yaContextCb.push(()=>{
  190.     Ya.adfoxCode.createScroll({
  191.             ownerId: 257193,
  192.         containerId: 'adfox_162819431226251126',
  193.             params: {
  194.                 pp: 'ksp',
  195.             ps: 'fcnb',
  196.             p2: 'fpxb'
  197.             }
  198.         },
  199.     ['desktop'],
  200.     {
  201.       tabletWidth: 1024,
  202.       phoneWidth: 767,
  203.       isAutoReloads: true
  204.     })
  205.   })
  206. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement