Update 1.js
This commit is contained in:
+12
-10
@@ -1,16 +1,18 @@
|
|||||||
/*BUTTON FLIP NORMALIZE*/
|
/*BUTTON MOVEMENT*/
|
||||||
const btnFlip = document.querySelector('.btn-flip');
|
const glassyButtons = document.querySelectorAll(".glassy-button");
|
||||||
|
glassyButtons.forEach((button) => {
|
||||||
|
button.addEventListener("mousemove", (event) => {
|
||||||
|
const centerX = button.offsetWidth / 2;
|
||||||
|
const centerY = button.offsetHeight / 2;
|
||||||
|
|
||||||
// Tıklama olayını ekliyoruz
|
const offsetX = event.offsetX - centerX;
|
||||||
btnFlip.addEventListener('click', function() {
|
const offsetY = event.offsetY - centerY;
|
||||||
// "active" sınıfını ekleyerek efekti başlatıyoruz
|
|
||||||
btnFlip.classList.add('active');
|
|
||||||
|
|
||||||
// 2 saniye sonra "active" sınıfını kaldırıyoruz
|
button.style.setProperty("--_x-motion", `${offsetX}px`);
|
||||||
setTimeout(function() {
|
button.style.setProperty("--_y-motion", `${offsetY}px`);
|
||||||
btnFlip.classList.remove('active');
|
|
||||||
}, 2000); // 2000 milisaniye (2 saniye)
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/*IMAGE CHANGER*/
|
/*IMAGE CHANGER*/
|
||||||
let currentIndex = 0;
|
let currentIndex = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user