-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPD:FIX:10.06.2024:19:30 => Миграция до gulp v5.0.0 + обновление неко…
…торых зависимостей разработки + обновление скрипта кошки мышки.
- Loading branch information
Ko2doo
committed
Jun 10, 2024
1 parent
f31f028
commit 51b8150
Showing
3 changed files
with
52 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
/* eslint-disable camelcase */ | ||
/* eslint-disable no-unused-expressions */ | ||
'use strict'; | ||
|
||
export const btnCardAnimals = () => { | ||
let cat_count = 2; | ||
let mouse_count = 4; | ||
|
||
const getButton = document.querySelector('.js-btn__card-animals'); | ||
const getCardItem = document.querySelector('.js-card-animals'); | ||
const getAnimal = document.querySelectorAll('.js-card-animals > ol > li'); | ||
|
||
const animal = getAnimal; | ||
|
||
for (let i = 0; i < animal.length; i++) { | ||
animal[i].setAttribute('data-animal-count', `${i}`); | ||
} | ||
|
||
getButton.addEventListener('click', function () { | ||
cat_count++; | ||
mouse_count--; | ||
|
||
getButton.addEventListener('click', (event) => { | ||
event.preventDefault; | ||
const styles = ['background: #faebd7; box-shadow: 0 4px 16px -4px rgb(239 146 23); transform: scale(1.2);']; | ||
const cat = animal[0]; | ||
cat.innerHTML = `cat : ${cat_count}`; | ||
|
||
getCardItem.classList.toggle('is-active'); | ||
const mouse = animal[2]; | ||
mouse.innerHTML = `mouse : ${mouse_count}`; | ||
|
||
if (document.querySelector('.js-card-animals.is-active') !== null) { | ||
getCardItem.setAttribute('style', styles); | ||
if (mouse_count === 0) { | ||
this.setAttribute('disabled', ''); | ||
cat.innerHTML = `Cats win!`; | ||
} else { | ||
getCardItem.removeAttribute('style'); | ||
this.removeAttribute('disabled', ''); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters