if (jQuery(window).width() < 768) {
jQuery('.web-vmenublockheader .t').css('display:block');
if (!chevron) {
chevron = jQuery('.web-vmenublockheader')
.append("<i class='icon-cheveron-down'></i>");
chevron.click(function () {
console.log("2");
$('.web-vmenublockcontent').slideToggle();
});
} …
jQuery(document).on('click', '.icon-cheveron-down', function () {
$('.web-vmenublockcontent').slideToggle();
});
var chevron;
jQuery(window).resize(function () {
if (jQuery(window).width() < 768) {
jQuery('.web-vmenublockheader .t').css('display:block');
if (!chevron) {
chevron = jQuery('.web-vmenublockheader').append("<i class='icon-cheveron-down'></i>");
}
} else {
jQuery('.web-vmenublockheader .t').css('display:none');
jQuery('.icon-cheveron-down').remove();
chevron = undefined;
}
document.addEventListener('click', function(ev){
let _links = document.querySelectorAll('ul.services-tab li a');
let clearActive = function(){
[].map.call(_links, function(_link){
_link.classList.remove('active');
});
};
if(ev.target.closest('ul.services-tab') && ev.target instanceof HTMLAnchorElement){
ev.preventDefault();
clearActive();
ev.target.classList.add('active');
}
});
let iconArray = ['v1.png', 'v2.png', 'v3.png' … 'vN.png'];
let container = document.querySelector('.icons');
let iconPath = 'http://anydomain/icons/';
[].map.call(iconArray, function(ico){
let newIcon = document.createElement('img');
newIcon.src = iconPath + ico;
container.appendChild(newIcon);
});
function addCallbacks(e) {
$(e).magnificPopup({
type:'ajax',
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in',
overflowY: 'scroll',
tLoading: 'Загрузка...',
fixedBgPos: true,
});
// и так перечислить все остальные плагины
}
$(document).ready(function() {
addCallbacks('.open-popup-ajax');
});
var el = $(…).append(…);
addCallbacks(el);