let arr = ['Main', 'Products', 'About us', 'Contacts']
let menu = document.getElementsByClassName('menu')[0]
let user = (param1, param2) => {
for (const user of param2) {
let li = document.createElement('li')
li.innerText = user
param1.append(li)
}
}
user(menu, arr)
el.style.height = "auto"
значение scrollHeight изменяется. Если изменить последовательность получения переменной, все будет работать аналогично второму варианту: function resize(event) {
const el = event.target;
el.style.height = "auto";
const height = event.target.scrollHeight;
el.style.height = `${height}px`;
console.log(height)
}
var like_all = document.getElementsByClassName("like_btn like")
like_all.forEach(like => {
like.click()
})
var like_all = document.getElementsByClassName("like_btn like")
let post = 0;
setInterval(() => {
like_all[post].click()
post++
}, 1000)
new Chart()
Chart.defaults.plugins.legend.display = false;
const sort = (a, b, result) => {
[a, b] = result > 0 ? [b, a] : [a, b];
}
modalContainer.scrollTop = 0;
function showModal(element) {
modalContainer.style.display = "block";
modalContainer.style.zIndex = "3";
let copyContent = element.target.closest('div').querySelector('.note-content').innerHTML;
modalContent.innerHTML = copyContent;
modalContainer.scrollTop = 0;
}
let str = 'Hi';
str[0] = 'h'; // ошибка
alert( str[0] ); // не работает
<div class="dark"></div>
.dark {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
cursor: pointer;
z-index: 9999;
}
function close_l() {
$('.dark').css({'display': 'none'})
$('.list_load, .list_item').stop();
$('.js-menu_toggle.opened').removeClass('opened').addClass('closed');
$('.side_menu').css({ 'left':'-270px' });
var count = $('.list_item').length;
$('.list_item').css({
'opacity':'0',
'margin-left':'-20px'
});
$('.list_load').slideUp(0);
}
$(document).on('click','.dark',function(e){
close_l();
});
$(document).on('click','.js-menu_toggle.opened',function(e){
close_l();
});
<div class="dark"></div>
.dark {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
cursor: pointer;
z-index: 9999;
}
$(document).on('click','.js-menu_toggle.closed',function(e){
$('.dark').css({'display': 'block'})
//
}
$(document).on('click','.js-menu_toggle.opened',function(e){
$('.dark').css({'display': 'none'})
//
}