<div class="changeable">
<div id="block-1" class="block visible">Первый</div>
<div id="block-2" class="block">Второй</div>
</div>
div.block {
display: none;
}
div.block.visible {
display: block;
}
$('.block').on('click', function(){
$(this).closest('.changeable').find('.block').toggleClass('visible');
});
$text = preg_replace('/\s+/', ' ', $text); // убираем склеенные пробелы
$array = explode(' ', $text); // делим как обычно по пробелам
div:hover img {
opacity: 0;
}
div img {
width: 200px;
height: 200px;
}
<div style="background: url(#) no-repeat center center">
<img src="#">
</div>
var i = 100;
while (i >= 0) {
if (i%50==0 || i%20==0 || i==10) {
document.write('Number: ' + i + '<br />');
}
i -= 10
}
function sticker1220() {
console.log('sticker1220');
};
function sticker950() {
console.log('sticker950');
};
function sticker320() {
console.log('sticker320');
};
function checksize() {
if ( $(window).width() > 1220 ) {
sticker1220();
} else if ( $(window).width() > 640 & $(window).width() < 1219 ) {
sticker950();
} else if ( $(window).width() < 639 ) {
sticker320();
}
};
checksize();
$(window).resize(function() {
checksize();
$('p').text($(window).width());
});
if(e.which == 39) {
if($('[data-popup-image-id="'+activeItemId+'"]').next().length !== 0) {
$('[data-popup-image-id="'+activeItemId+'"]').next().addClass('active');
$('[data-popup-image-id="'+activeItemId+'"]').removeClass('active');
$('.popup_gallery__images-item').data('popupImageId', activeItemId + 1);
}
}
if(e.which == 37) {
if($('[data-popup-image-id="'+activeItemId+'"]').prev().length !== 0) {
$('[data-popup-image-id="'+activeItemId+'"]').prev().addClass('active');
$('[data-popup-image-id="'+activeItemId+'"]').removeClass('active');
$('.popup_gallery__images-item').data('popupImageId', activeItemId - 1);
}
}
$('select').change(function() {
if ( navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 ) {
var selIndex = $(this).find('option:selected').index()+1;
$(this)
.find('option')
.removeAttr('selected')
.end()
.find('option:nth-child('+selIndex+')')
.attr('selected', 'selected')
.end()
.find('option:not(:nth-child('+selIndex+'))')
.prop('selected', false)
.end()
.find('option:nth-child('+selIndex+')')
.prop('selected', true)
} else {
var selIndex = $(this).find('option:selected').index()+1;
$(this).find('option').removeAttr('selected').end().find('option:nth-child('+selIndex+')').attr('selected', 'selected');
$(this).val($(this).find('option[selected="selected"]').val());
}
// $(this).val()
$.ajax({
url: '',
data: {
a: $(this).val()
},
// ...
})
})