View прилипающий блок
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (){ | |
const stickyBlock = $('.js-sticky-block'); | |
const stickyBlockParent = $('.privacy__sidebar'); | |
const block_pos = stickyBlock.offset().top; | |
const wrap_pos = stickyBlockParent.offset().top; | |
const block_height = stickyBlock.outerHeight(); | |
const wrap_height = stickyBlockParent.outerHeight(); | |
const block_width = stickyBlock.outerWidth(); | |
const pos_absolute = wrap_pos + wrap_height - block_height; | |
$(window).scroll(function () { |
View нумерация
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (){ | |
const $infoListCount = $('.info__list'); | |
const $infoItemCount = '.info__item'; | |
const $infoNumCount = '.info__num'; | |
$infoListCount.each(function(){ | |
$($infoItemCount, this).each(function(i){ | |
$(this).find($infoNumCount).text(('0' + (i+1)).slice(-2)); | |
}); | |
}); | |
})(); |
View липкая шапка
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//fixed header | |
$(function() { | |
const header = $('.header'); | |
const headerFixed = 'header--fixed'; | |
$(window).scroll(function() { | |
if($(this).scrollTop() > 1) { | |
header.addClass(headerFixed); | |
} else { | |
header.removeClass(headerFixed); | |
} |
View прижатый подвал
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html{ | |
height: 100%; | |
} | |
body{ | |
display: flex; | |
flex-direction: column; | |
height: 100%; | |
} | |
.header{ | |
flex: 0 0 auto; |
View группа чекбоксов
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class=""> | |
<label class="form-label"> | |
<input class="jq-check-all" type="checkbox" data-id="sort"> | |
<span class="form-label__capt">Все</span> | |
</label> | |
<label class="form-label"> | |
<input class="jq-check-rest" type="checkbox" data-id="sort"> | |
<span class="form-label__capt"></span> | |
</label> | |
</div> |
View dns-prefetch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta http-equiv="x-dns-prefetch-control" content="on"> | |
<link rel="dns-prefetch" href="https://www.googletagmanager.com"> | |
<link rel="dns-prefetch" href="https://connect.facebook.net"> | |
<link rel="dns-prefetch" href="https://www.google-analytics.com"> | |
<link rel="dns-prefetch" href="https://adservice.google.com"> | |
<link rel="dns-prefetch" href="https://staticxx.facebook.com"> | |
<link rel="dns-prefetch" href="https://www.facebook.com"> | |
<link rel="dns-prefetch" href="https://tpc.googlesyndication.com"> | |
<link rel="dns-prefetch" href="https://ajax.googleapis.com"> | |
<link rel="dns-prefetch" href="https://fonts.googleapis.com"> |
View jq активный пункт меню
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var link = $('.link'); | |
link.each(function() { | |
if ( (window.location.pathname.indexOf( $(this).attr('href') ) ) > -1) { | |
$(this).addClass('selected'); | |
} | |
}); |
View js collapse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelectorAll('.js-collapse').forEach(function(accordion) { | |
accordion.addEventListener('click', function(event) { | |
//event.preventDefault(); | |
let subAccordion = accordion.querySelector('.js-collapse-target'); | |
let clickTarget = event.target; | |
if( clickTarget.closest('.js-collapse-toggle') ) { | |
accordion.classList.toggle('open'); | |
setTimeout(function() { | |
if (subAccordion.style.maxHeight) { | |
subAccordion.style.maxHeight = null; |
View js hasClass, addClass, removeClass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hasClass(el, className) { | |
return el.classList ? el.classList.contains(className) : new RegExp('\\b'+ className+'\\b').test(el.className); | |
} | |
function addClass(el, className) { | |
if (el.classList) el.classList.add(className); | |
else if (!hasClass(el, className)) el.className += ' ' + className; | |
} | |
function removeClass(el, className) { | |
if (el.classList) el.classList.remove(className); | |
else el.className = el.className.replace(new RegExp('\\b'+ className+'\\b', 'g'), ''); |
View js обертка элементов
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ready (MutationObserver) | |
(function(win) { | |
'use strict'; | |
var listeners = [], | |
doc = win.document, | |
MutationObserver = win.MutationObserver || win.WebKitMutationObserver, | |
observer; | |
function ready(selector, fn) { | |
listeners.push({ | |
selector: selector, |
NewerOlder