elem.parentNode.classList.add('hide');
elem.parentNode.classList.remove('hide');
let url = "https://jekyllrb.com/?text=" + encodeURIComponent(text) +"&phone=" +encodeURIComponent(number);
document.querySelector('.js-iframe').src = url;
var links = ['#tab1'];
var blockLinks = true; // флаг блокировки меню
// функция выполняющаяся по истечении таймаута
function pausePage (){
// сбрасываем флаг блокировки меню
blockLinks = false;
// далее остальной код .........
links.splice([1],1);
$(pages).addClass('hide').removeClass('anim').removeClass('anim2');
$(id).removeClass('hide').addClass('anim');
}
$(function(){
// ниже код который выполняется после загрузки страницы
// устанавливаем обработчик на click
$('.tabs li a').on('click', function(e){
// проверяем флаг blockLinks
if (blockLinks) {
// если установлена блокировка выходим!
e.preventDefault();
return false;
}
// здесь ниже код который должен выполняться по клику
// ................
// ................
});
// запускаем таймер
setTimeout (pausePage,3000);
})
Отсюда вопрос, как в эту конструкцию забросить ID конкретного блока, чтобы эффект применялся только к нему.
$(function() {
$('#BLOCK_ID').hover(
function(){
document.getElementById("BLOCK_ID").style.display="block";
$('#BLOCK_ID').animate({height:350});
},
function(){
$('#BLOCK_ID').animate({height:100});
document.getElementById("BLOCK_ID").style.display="none";
});
});
$(function() {
$('#BLOCK_ID').hover(
function(){
$("#BLOCK_ID").css("display", "block");
$('#BLOCK_ID').animate({height:350});
},
function(){
$('#BLOCK_ID').animate({height:100});
$("#BLOCK_ID").css("display", "none");
});
});
А JQuery в несложных операциях редко подводит. Этот случай редкость, если это вообще из-за JQ
$(function(){
if ($(window).width() < 1184) {
$( "#nav1" ).css( "display", 'none');
$( "#nav2" ).css( "display", 'none');
}
$(window).resize(function(){
if ($(window).width() < 1184) {
$( "#nav1" ).css( "display", 'none');
$( "#nav2" ).css( "display", 'none');
} else {
$( "#nav1" ).css( "display", 'flex');
$( "#nav2" ).css( "display", 'flex');
}
})
$( ".nav-logo" ).click(function() {
if ($(window).width() < 1184) {
$( "#nav1" ).toggle( "slow", function() {
// Animation complete.
// $(this).rotate(100);
});
$( "#nav2" ).toggle( "slow", function() {
// Animation complete.
// $(this).rotate(100);
});
} else {
$( "#nav1" ).css( "display", 'flex');
$( "#nav2" ).css( "display", 'flex');
}
});
});
window.matchMedia('screen and (max-width: 1184px)').matches
if (window.matchMedia('screen and (max-width: 1184px)').matches) {
$( "#nav1" ).css( "display", 'none');
$( "#nav2" ).css( "display", 'none');
} else {
$( "#nav1" ).css( "display", 'flex');
$( "#nav2" ).css( "display", 'flex');
}
let merged = [...array1, ...array2].map(i => i.name);
if (new Set(merged).size === merged.length/2) {
// равны
} else {
// не равны
}
if (JSON.stringify(obj1) === JSON.stringify(obj2)) {
// равны
} else {
// не равны
}
$('.s6035')и уже с ними производить манипуляции, для этого есть метод .each
$(".plus").on("click", function(){
$.each($(".s6035"), function(index, element){
$(element).text(parseInt($(element).text()) + parseInt($(element).data("col")))
})
})
$(".minus").on("click", function(){
$.each($(".s6035"), function(index, element){
$(element).text(parseInt($(element).text()) - parseInt($(element).data("col")))
})
})
$(document).ready(function(){
$('.main-foto').zoom({url: 'photo-big.jpg', on: 'click'});
});
window.onload = () => {
document.querySelectorAll("input").forEach(el => {el.addEventListener("change",()=>{document.querySelector(".result").innerHTML="<button>Применить</button>"})});
}
document.location.href = "profile.php";
success: function(data){
console.log(data);
document.location.href = "profile.php";
},
});
function changeBackground(){
var h = (new Date()).getHours();
var b = document.body;
if (h > 0 && h < 6) {
// ночь
img = 'https://images.wallpaperscraft.com/image/moon_branch_night_clouds_48105_1920x1080.jpg';
} else if (h >=6 && h < 10) {
// утро
img = 'https://i.artfile.me/wallpaper/11-09-2012/1920x1080/priroda-voshody-zakaty-lug-voshod-utro-t-660656.jpg';
} else if (h >= 10 && h < 19) {
// день
img = 'https://get.wallhere.com/photo/sunlight-nature-grass-sky-field-horizon-cloud-grassland-meadow-plain-1920x1080-px-prairie-computer-wallpaper-cumulus-573793.jpg';
} else if (h >= 19) {
// вечер
img = 'https://www.bmwunstoppable.com/wp-content/uploads/2017/03/5nXkqs.jpg';
}
b.style = 'background-image: url('+img+')';
setTimeout(changeBackground, 60000);
}
changeBackground();
el.style = 'background-image: url('+img+')';
cell.textContent
cell.children[0].value
<hmtl>
<style>
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
text-align: center;
}
</style>
<body>
<div id="app"></div>
<table>
<tr data-new="1" data-id="1">
<td data-name="cell_11"><input type="text" value="11"></td>
<td data-name="cell_12"><input type="text" value="12"></td>
</tr>
<tr data-new="2" data-id="2">
<td data-name="cell_21"><input type="text" value="21"></td>
<td data-name="cell_22"><input type="text" value="22"></td>
</tr>
</table>
<script>
var x = {};
[].forEach.call(document.querySelectorAll("tr"), function(el) {
if (+el.getAttribute("data-new") >= 0) {
let inn = (x[el.getAttribute("data-id")] = {});
[].forEach.call(el.children, function(cell) {
inn[cell.getAttribute("data-name")] = cell.children[0].value;
});
}
});
var dataJSON = JSON.stringify(x)
document.querySelector("#app").innerHTML = dataJSON;
</script>
</body>
</hmtl>
cell.getElementsByTagName("input")[0].value