forked from Dgors03/Answer_Templates
add night theme
This commit is contained in:
@@ -317,12 +317,18 @@ window.onload = function () {
|
||||
});
|
||||
};
|
||||
|
||||
// Кнопка и иконка
|
||||
const themeToggle = document.getElementById('theme-toggle');
|
||||
const themeIcon = document.getElementById('theme-icon');
|
||||
|
||||
themeToggle.addEventListener('click', () => {
|
||||
document.body.classList.toggle('dark-theme');
|
||||
});
|
||||
const buttons = document.querySelectorAll('.btn');
|
||||
// editExisted.addEventListener('click', (e) => {
|
||||
// textRUEl.innerHTML = `<span onClick="copyToClipboard('${e.target.value}')" class="btn btn-light" id="template-ru-text">RU</span>`
|
||||
// })
|
||||
// Обработчик клика
|
||||
themeToggle.addEventListener('click', () => {
|
||||
document.body.classList.toggle('dark-theme'); // Переключаем класс для темы
|
||||
|
||||
// Меняем иконку
|
||||
if (document.body.classList.contains('dark-theme')) {
|
||||
themeIcon.classList.replace('fa-sun', 'fa-moon');
|
||||
} else {
|
||||
themeIcon.classList.replace('fa-moon', 'fa-sun');
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user