.menu {
position: fixed;
top: 0;
right: 0;
background: none;
}
@media screen and (max-width: 640px) {
background: orange !important;
}
$(window).on('load scroll', function() {
if ($(this).scrollTop() >= '1') {
$('.menu').css('background', 'orange');
} else {
$('.menu').css('background', 'none');
}
});
const divSquare = document.querySelector('.square');
const circle = document.querySelector('.circle');
// divSquare.hidden = false;
document.querySelector('.nbt').onclick = () => {
const inp1 = document.querySelector('.width').value;
divSquare.style.border = "1px solid black";
divSquare.style.width = `${inp1}px`;
divSquare.style.height = `${inp1}px`;
divSquare.style.position = 'relative';
}
document.querySelector('.btnz').onclick = () => {
const inp3 = document.querySelector('.width1').value;
circle.style.width = `${inp3}px`;
circle.style.height = `${inp3}px`;
circle.style.borderRadius = "100%";
circle.style.background = "rgba(0, 0, 0, .3)";
circle.style.position = 'absolute';
circle.style.top = '50%';
circle.style.left = '50%';
circle.style.transform = 'translate(-50%, -50%)';
}
document.querySelector('.btnGroup').addEventListener('click', event => {
let step = +document.querySelector('.width2').value;
let action = event.target.innerText;
switch (action) {
case "Up":
circle.style.top = circle.offsetTop - step + 'px';
break;
case "Left":
circle.style.left = circle.offsetLeft - step + 'px';
break;
case "Down":
circle.style.top = circle.offsetTop + step + 'px';
break;
case "Right":
circle.style.left = circle.offsetLeft + step + 'px';
break;
}
});
document.getElementById('button').onclick = function() {
var a = document.getElementById('input').value
}
products.map((items) => {
<GameProduct product={items} />
});
=> ({})
, либо так =>
:products.map(items =>
<GameProduct product={items} />
);
var factorial = function(n) { // объявление функции
var cnt // объявление пустой переменной cnt
var res = 1 // объявление переменной res со значением 1
for (cnt = n; cnt > 1; cnt--) { // цикл, по типу: for (var i = 0; i < 5; i++)
// то есть пустой переменной cnt присваивается значение,
// которое пришло в аргументе n при вызове функции (в данном случае 4),
// цикл выполняется пока cnt больше 1, на каждой итерации от cnt отнимается 1
res *= cnt; // значение res умножается на cnt
}
return res // возвращает получившееся значения res
}
console.log(factorial(4)) // выполнение функции с n = 4