Похожие чаты

Hello guys, I want to handle a hover + onclick

event (as telegram does when you select messages to forward) and this is what I come up with:

let isClicked = false;
document.addEventListener("mousedown", function(event) {
isClicked = true;
})
document.addEventListener("mouseup", function(event) {
isClicked = false;
})

const messages = document.querySelectorAll(".message.default");

messages.forEach((message) => {
message.addEventListener("mouseenter", function (event) {
if (isClicked) {
console.log("click+hover");
}
});
});

can be done better?

1 ответов

15 просмотров

Send a video about that functionality Telegram does 🤔

Похожие вопросы

Карта сайта