简体   繁体   中英

jQuery click event on iPad not working properly

The click event should work fine:

  subMenu = $(".sub-menu")
  //....
  subMenu.show()
  $("a.mobile").click (e) ->
      menuContainer.toggle()
      e.preventDefault()

This should toggle the menu on click/tap. The weird thing is that it does it just fine for the first open and close. Starting with the second time, to open, I have to click "a.mobile" twice. I've tried bind, and a bunch of other options. The CSS is actually displaying the link as it were hovered when it's not double-tapped.

I'm not 100% sure about .click() function, however i use .on('click') for handle events on my application and it works everywhere (including IPads ). Nevertheless as suggested by the comments, perhaps there is something elsewhere preventing the click to work as you expect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM