S
S
Sadko_MVS2019-12-23 00:32:58
JavaScript
Sadko_MVS, 2019-12-23 00:32:58

Click event not firing on ios?

There is a script that calls a popup window.
But in ios safari it doesn't work.
There is information on the Internet that on mobile apple devices, the click event only fires for links.
And there are options for how to get around this moment, such as adding an onclick event to an element or a cursor pointer in css /
I tried these options, but I did not solve the problem.
here is the script itself:

let buttonItem = document.querySelectorAll('.button'),
    overlayButton = document.querySelector('.overlay-button'),
    closeButton = document.querySelector('.close-button');

buttonItem.forEach(item => {
    item.addEventListener("click", e => {

    overlayButton.style.display = 'block';
    });
});
closeButton.addEventListener("click", e => {
    overlayButton.style.display = 'none';
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pashenka, 2019-12-23
@Sadko_MVS

there is an infa that on mobile apple devices, the click event fires only for links

This is not true. The click event fires either on the document or on the div:
The problem is something else.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question