const videos = document.querySelectorAll('video');
const onPlay = e => videos.forEach(n => n !== e.target && n.pause());
videos.forEach(n => n.addEventListener('play', onPlay));
<picture>
<source media="(min-width: 64em)" src="high-res.jpg">
<source media="(min-width: 37.5em)" src="med-res.jpg">
<source src="low-res.jpg">
<img src="fallback.jpg" alt="This picture loads on non-supporting browsers.">
<p>Accessible text.</p>
</picture>
.select2-selection__choice::after {
content: ',';
}
.select2-selection__choice:last-child::after {
content: '';
}
.select2-selection__rendered li:nth-last-child(2)::after {
content: '';
}
.tags li.hidden {
display: none;
}
document.querySelectorAll('.tags b').forEach(n => {
n.closest('li').classList.add('xxx');
n.addEventListener('click', onClick);
});
function onClick(e) {
for (
let el = e.target.closest('li');
(el = el.nextElementSibling) && !el.classList.contains('xxx');
el.classList.toggle('hidden')
) ;
}
$(document).scroll(function () {
if ($(this).scrollTop() <= ($(".block").offset().top - $(window).height())) {
//sticky
} else {
//not sticky
}
}
$list.find('input').click(e => e.stopPropagation());
if (!$(e.target).is('input')) {
$list.hide();
}
$('#topPanel').val(valTop.join(''));
valTop.push(row['value']);
$('#topPanel').val(valTop.join('\r\n'));
[1,2,3].toString() // "1,2,3"
[1,2,3].join(''); // 123
[1,2,3].join(); // 1,2,3
.dropdown {
display: flex;
}
.dropdown-content {
flex-flow: column;
width: 100%;
}
$(response).filter('.item').each(function() {
$owl.trigger('add.owl.carousel', this);
});
$owl.trigger('refresh.owl.carousel');
navContainer: $(this).prev().find('.arrows')
.arrows
и у .i-catalogList
всё-таки был общий предок if (coord.every((n, i) => n === coordinates[i])) {
placemark.balloon.open();
}
const placemarks = elem.find('.map-balloonContent').get().map(n => createPlacemark({
coord: $(n).data('coord'),
content: $(n).html(),
}));
placemarks.forEach(n => myMap.geoObjects.add(n));
placemarks[0].balloon.open();
elem.on('clickAddress', function(e, coord) {
placemarks.find(n => n.geometry.getCoordinates().every((m, i) => m === coord[i])).balloon.open();
});
<div class="container">
<div>div 1</div>
<div>div 2</div>
<div>div 3</div>
<div>div 4</div>
<div>div 5</div>
<div>div 6</div>
<div>div 7</div>
</div>
(function($) {
$.fn.classСycle = function(o) {
var _this = this,
opt = $.extend({
class: 'default_class',
delay: 1000
}, o),
divs = $('div', this),
len = divs.length - 1,
init = function(i) {
setTimeout(() => {
divs.removeClass(opt.class);
$(this).addClass(opt.class);
if (i >= len) {
setTimeout(() => $.fn.classСycle.call(_this, opt), opt.delay);
}
}, i * opt.delay);
};
return divs.each(init);
};
}(jQuery));
// Использование
$('.container').classСycle({
class: 'active', // активный класс
delay: 750 // задержка
});