const container = document.querySelector('.takeout-nav');
let containerRect = container.getBoundingClientRect();
let activeOptionRect = activeOption.getBoundingClientRect(); //activeOption - пункт меню, на который навешивается .active
if (containerRect.left + containerRect.width < activeOptionRect.left + activeOptionRect.width){
container.scrollLeft += activeOptionRect.left - containerRect.left;
}
else if (activeOptionRect.left < containerRect.left){
container.scrollLeft -= containerRect.left - activeOptionRect.left;
}
cash[i] =Number( prompt('Сколько положить?'))
if(cash[i]>-1001 && cash[i]<=1001)
let card =[0,1,2,3,4,5,6,7,8,9];
let cash = [0,0,0,0,0,0,0,0,0,0,0];
let sum=0;
let number = Number(prompt('Какая карта?'));
while (number < 0 || number > 9){
number = Number( prompt('Какая карта?'));
}
let value = Number(prompt('Сколько положить?'));
while (value < -1000 || value > 1000){
value = Number(prompt('Сколько положить?'));
}
cash[number] += value;
for (let i=0; i < cash.length; i++){
sum += cash[i];
}
alert(`Сумма по картам: ${sum}`);
let clock = document.querySelector('.clock');
let arrColors = ['rgba(255, 0, 0, .1)','rgba(255, 0, 0, .2)','rgba(255, 0, 0, .3)','rgba(255, 0, 0, .4)','rgba(255, 0, 0, .5)','rgba(255, 0, 0, .6)', 'rgba(255, 0, 0, .7)', 'rgba(255, 0, 0, .8)','rgba(255, 0, 0, .9)', 'rgba(255, 0, 0, 1)'];
const changeColor = (color, delay) => {
clock.style.filter = `drop-shadow(0 0 14px ${color})`;
return new Promise((resolve) => setTimeout(resolve, delay));
}
setInterval(async function(func){
for(let i = 0; i < arrColors.length; i++){
await func(arrColors[i], 2000);
}
}, arrColors.length * 2000, changeColor);