i want to change the value of a pseudo element with a random emoji. what i tried doesn't work. can you offer a solution?
css
.marquee span:after {
content: attr(data-after);
}
javascript
const emojis = ['💵','💰','💳','💶','🐷','🐽','🐖','🔥','🖕', '😡', '🤬', '😠', '👿'];
const random = function () {
randomEmoji = Math.floor(Math.random() * data.length)
}
const updateEmoji = function (ev) {
const span = document.querySelector('.marquee span');
ev.span.setAttribute('data-before', randomEmoji);
}
Aucun commentaire:
Enregistrer un commentaire