Skip to content

Instantly share code, notes, and snippets.

document.addEventListener("DOMContentLoaded", () => {
const openBtn = document.querySelector(".open-modal"); // одна кнопка
const closeBtn = document.querySelector(".close-modal"); // одна кнопка закриття
const modal = document.querySelector(".modal"); // одна модалка
// Відкрити модалку
openBtn.addEventListener("click", () => {
modal.classList.add("active");
});
@zenya385
zenya385 / тільки унікальні елементи у масиві
Last active March 6, 2025 17:45
тільки унікальні елементи у масиві indexOf()
const uniqueArray2 = alltegs.filter((item, index, self) => self.indexOf(item) === index); // тільки унікальні елементи у масиві
@zenya385
zenya385 / масив унікальних зачень new Set
Created March 6, 2025 17:43
повертає масив унікальних зачень new Set
const uniqueArray1 = [...new Set(alltegs)]; // тільки унікальні елементи, самий простий спосіб
@zenya385
zenya385 / modal.js
Last active October 2, 2025 15:07
відкритя модалок по кліку на різні кнопки
document.addEventListener("DOMContentLoaded", () => {
const openModalButtons = document.querySelectorAll(".open-modal");
const closeModalButtons = document.querySelectorAll(".close-modal");
const modals = document.querySelectorAll(".modal");
// Функція для відкриття модального вікна
const openModal = (modalId) => {
const modal = document.getElementById(modalId);
if (modal) {
modal.classList.add("active");
@zenya385
zenya385 / active page
Created June 20, 2024 17:30
Добавляє підкреслення на активній сторінці
.active::after {
content: "";
display: block;
height: 3px;
width: 100%;
border-radius: 7px;
background-color: #f38181;
margin-top: 10px;
}
@zenya385
zenya385 / gist:2e424a71b9f3da589860c96c24e89b47
Last active June 19, 2024 16:24
modern-normalize_2.0.0_ link-cdn
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/2.0.0/modern-normalize.min.css" integrity="sha512-4xo8blKMVCiXpTaLzQSLSw3KFOVPWhm/TRtuPVc4WG6kUgjH6J03IBuG7JZPkcWMxJ5huwaBpOpnwYElP/m6wg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
@zenya385
zenya385 / cdn normalize link
Last active September 3, 2023 09:00
normalize cdn link
@zenya385
zenya385 / *.html
Created July 29, 2023 11:06
cdn_link_reset_
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/jgthms/minireset.css@master/minireset.min.css">
@zenya385
zenya385 / reset.css
Last active June 10, 2024 15:33
resetter-css
html,
body,
p,
ol,
ul,
li,
hr,
h1,
h2,
h3,
@zenya385
zenya385 / .gitignore
Created June 26, 2023 12:53
file gitignore for windows node VSCode
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Created by https://www.toptal.com/developers/gitignore/api/node,windows,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=node,windows,visualstudiocode
### Node ###
# Logs
logs
*.log
npm-debug.log*