better script.js
This commit is contained in:
parent
debd6e95a0
commit
c9bfd3be98
@ -1,4 +1,4 @@
|
|||||||
// BULMA BURGER
|
// BULMA BURGER MENU
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const burgers = Array.from(document.querySelectorAll('.navbar-burger'));
|
const burgers = Array.from(document.querySelectorAll('.navbar-burger'));
|
||||||
|
|
||||||
@ -11,19 +11,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
targetMenu.classList.toggle('is-active');
|
targetMenu.classList.toggle('is-active');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// DARK MODE
|
// DARK MODE
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
const switchTheme = document.querySelector("#switch");
|
const switchTheme = document.querySelector("#switch");
|
||||||
|
|
||||||
switchTheme.addEventListener("click", function () {
|
switchTheme.addEventListener("click", function () {
|
||||||
document.body.classList.toggle("dark-mode");
|
document.body.classList.toggle("dark-mode");
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// CAROUSSEL
|
// CAROUSSEL
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
const track = document.querySelector('.carousel-track');
|
const track = document.querySelector('.carousel-track');
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
|
||||||
@ -36,10 +32,9 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
index = (index + 1) % document.querySelectorAll('.carousel-slide').length;
|
index = (index + 1) % document.querySelectorAll('.carousel-slide').length;
|
||||||
updateSlide();
|
updateSlide();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
});
|
|
||||||
|
|
||||||
// BOUTON
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
// TRICKY BOUTON
|
||||||
const container = document.querySelector('.button-area');
|
const container = document.querySelector('.button-area');
|
||||||
const button = document.getElementById('trickyButton');
|
const button = document.getElementById('trickyButton');
|
||||||
|
|
||||||
@ -53,19 +48,15 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
button.style.left = `${randomX}px`;
|
button.style.left = `${randomX}px`;
|
||||||
button.style.top = `${randomY}px`;
|
button.style.top = `${randomY}px`;
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// COMPTEUR
|
// COMPTEUR
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
let compteur = 0;
|
let compteur = 0;
|
||||||
document.getElementById("incrementer").addEventListener("click", () => {
|
document.getElementById("incrementer").addEventListener("click", () => {
|
||||||
compteur++;
|
compteur++;
|
||||||
document.getElementById("compteur").textContent = compteur;
|
document.getElementById("compteur").textContent = compteur;
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// ADDITION
|
// ADDITION
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
document.getElementById("additionner").addEventListener("click", () => {
|
document.getElementById("additionner").addEventListener("click", () => {
|
||||||
const a = parseFloat(document.getElementById('chiffre1').value);
|
const a = parseFloat(document.getElementById('chiffre1').value);
|
||||||
const b = parseFloat(document.getElementById('chiffre2').value);
|
const b = parseFloat(document.getElementById('chiffre2').value);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user