JQuery not working in iOS?

I added some simple javascript to the site:

jQuery(document).click(function(){
  alert('click');
});

... and it only runs on iOS when someone clicks on the actual anchor element, button element, or something with cursor: pointer;CSS.

In particular, I see this with the Bootstrap 3 fixed navigation menu. When it opens, I added:

jQuery(document).click(function(){
  jQuery('#navbar-collapse.collapse.in').collapse('hide');
});

so that it closes no matter where someone clicks.

This does not work on iOS (tested on iPhone 4, iPhone 6/6 + and iPads).

It seems that jQuery click events are logged only on "clickable" elements (A, BUTTON, etc.) or in elements with cursor: pointer;CSS attributes or onClick='...something...'or even or onClick=''HTML.

So my question. Is it just me? Does anyone else see this?

+4
1

. , , , . , , IOS.

.

Clickable

- , Safari iOS , iOS. , , mousemove, 6-1, , iOS .

6-1 mouseover

<span onmouseover = "..."
  onmouseout  = "..."
WHERE TO BUY
</span>

, onclick, onclick = "void (0)", Safari iOS span , , 6-2.

6-2 onclick

<span onmouseover = "..."
  onmouseout  = "..."
  onclick = "void(0)">
WHERE TO BUY
</span>
+7

Source: https://habr.com/ru/post/1626248/


All Articles