Ajout d'un effet pour le passage sur les boutons de don

This commit is contained in:
nono-lqdn 2026-01-30 12:35:15 +01:00
parent f7c88f2a69
commit c47bd42d46

21
js/pop.js Normal file
View file

@ -0,0 +1,21 @@
document.querySelectorAll('button').forEach(function(button) {
button.addEventListener('mouseenter', function() {
function random(max) {
return Math.random() * (max - 0) + 0;
}
var c = document.createDocumentFragment();
for (var i = 0; i < 100; i++) {
var styles = 'transform: translate3d(' + (random(500) - 250) + 'px, ' +
(random(200) - 150) + 'px, 0) rotate(' + random(360) + 'deg);' +
'background: hsla(' + random(360) + ', 100%, 50%, 1);' +
'animation: bang 700ms ease-out forwards;' +
'opacity: 0';
var e = document.createElement("i");
e.style.cssText = styles;
c.appendChild(e);
}
button.appendChild(c);
});
});