Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- в head
- <script>window.yaContextCb = window.yaContextCb || []</script>
- <script src="https://yandex.ru/ads/system/context.js" async></script>
- _________________________
- в body
- <!-- 320x100-->
- <!-- CLICKIO AdFox unit 679590 -->
- <div id="lx_sticky">
- <div id="lx_noclick"></div>
- <button id="lx_close_button"></button>
- <div id='adfox_162819537282752203'></div>
- </div>
- <script>
- (function(w, n) {
- window.yaContextCb.push(()=>{
- Ya.adfoxCode.createScroll({
- ownerId: 257193,
- containerId: 'adfox_162819537282752203',
- params: {
- pp: 'ksq',
- ps: 'fcnb',
- p2: 'fpxb'
- }
- },
- ['phone'],
- {
- tabletWidth: 1024,
- phoneWidth: 767,
- isAutoReloads: true
- })
- })
- </script>
- <style>
- :root {
- --lx-bg-color: #fff;
- --lx-cross-color: #000;
- }
- #lx_sticky {
- width: 100%;
- max-height: 104px;
- padding-top: 4px;
- z-index: 2147483647;
- position: fixed;
- bottom: 0px;
- background: var(--lx-bg-color);
- text-align: center;
- transition: 300ms ease-in;
- line-height: 0px;
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2) !important;
- }
- #lx_sticky #lx_close_button {
- position: absolute;
- width: 44px;
- height: 30px;
- top: -30px;
- left: 0px;
- background-size: 13px 13px;
- background-position: 9px;
- background-color: var(--lx-bg-color);
- background-repeat: no-repeat;
- box-shadow: 0 -1px 1px 0 rgba(0, 0, 0, 0.2);
- border: none;
- border-radius: 0 12px 0 0;
- outline: none;
- font-family: verdana;
- font-size: 0px;
- color: var(--lx-cross-color);
- }
- #lx_sticky #lx_close_button:before {
- content: "";
- display: inline-block;
- width: 10px;
- height: 10px;
- transform: rotate(-45deg);
- border-left: 2px solid var(--lx-cross-color);
- border-bottom: 2px solid var(--lx-cross-color);
- position: relative;
- top: -3px;
- }
- #lx_sticky #lx_close_button span {
- width: 28px;
- height: 28px;
- line-height: 28px;
- text-align: center;
- display: block;
- position: relative;
- color: var(--lx-cross-color);
- z-index: 1;
- }
- #lx_sticky #lx_noclick {
- position: absolute;
- top: -55px;
- left: 0px;
- height: 85px;
- width: 66px;
- }
- </style>
- <script>
- (function(){
- var lxAdUnit = document.querySelector("#lx_sticky");
- var lxCloseButton = document.querySelector("#lx_close_button");
- function lxCloseUnit() {
- while (lxAdUnit.hasChildNodes()) {
- lxAdUnit.removeChild(lxAdUnit.lastChild);
- }
- }
- lxCloseButton.onclick = lxCloseUnit;
- var noClick = document.querySelector("#lx_sticky #lx_noclick");
- function lxNoClickHndlr(e) {
- e.preventDefault();
- e.stopPropagation();
- return false;
- }
- noClick.addEventListener("click", lxNoClickHndlr);
- })();
- </script>
- <!-- CLICKIO AdFox unit 679588 -->
- <script>
- document.addEventListener("DOMContentLoaded", function(event) {
- var Sticky = (function() {
- var CSS_CLASS_ACTIVE = 'is-fixed';
- var Sticky = {
- element: null,
- position: 0,
- addEvents: function() {
- window.addEventListener('scroll', this.onScroll.bind(this));
- },
- init: function(element, end) {
- this.element = element;
- this.addEvents();
- this.position = element.getBoundingClientRect().top + pageYOffset;;
- this.onScroll();
- },
- aboveScroll: function() {
- return this.position < window.pageYOffset;
- },
- underScroll: function() {
- return end.getBoundingClientRect().top + pageYOffset <= window.pageYOffset + this.element.getBoundingClientRect().height;
- },
- onScroll: function(event) {
- if (this.aboveScroll() == true && this.underScroll() == false) {
- this.setFixed();
- } else {
- this.setStatic();
- }
- },
- setFixed: function() {
- this.element.classList.add(CSS_CLASS_ACTIVE);
- this.element.style.position = 'fixed';
- this.element.style.top = "10px";
- },
- setStatic: function() {
- this.element.classList.remove(CSS_CLASS_ACTIVE);
- this.element.style.position = 'relative';
- this.element.style.top = 0;
- }
- };
- return Sticky;
- })();
- // Запускаем прилипание для элементов на странице
- // sticky -- элемент, который будет "прилипать" к верху
- var sticky = document.querySelector('#adfox_162819431226251126');
- // end -- элемент перед которым "прилипание будет сбрасываться"
- var end = document.querySelector('#mw-body');
- if (sticky)
- Sticky.init(sticky, end);
- });
- </script>
- <div id="adfox_162819431226251126"></div>
- <script>
- window.yaContextCb.push(()=>{
- Ya.adfoxCode.createScroll({
- ownerId: 257193,
- containerId: 'adfox_162819431226251126',
- params: {
- pp: 'ksp',
- ps: 'fcnb',
- p2: 'fpxb'
- }
- },
- ['desktop'],
- {
- tabletWidth: 1024,
- phoneWidth: 767,
- isAutoReloads: true
- })
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement