The click event should work fine:

click事件应该可以正常工作:

  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.

这应该在点击/点击时切换菜单。奇怪的是它在第一次打开和关闭时做得很好。从第二次开始,要打开,我必须点击“a.mobile”两次。我尝试过bind,以及其他一些选项。 CSS实际上是显示链接,因为它没有被双击。

1 个解决方案

#1


1

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.

我不是100%肯定.click()函数,但我使用.on('click')处理我的应用程序上的句柄事件,它可以在任何地方工作(包括IPads)。尽管如此,根据评论的建议,也许其他地方会阻止点击按预期工作。

更多相关文章

  1. jquery编写web页面头部分类的选中事件$.cookie("currentIndex",
  2. 动态生成 ul 的li jquery 点击事件无法获取到li
  3. jQuery 事件绑定方法(bind hover toggle live.... )、删除事件方法
  4. 确定焦点事件:单击或tabstop
  5. 使用JQuery显示和隐藏不同div的onClick事件
  6. jQuery中的bind绑定事件与文本框改变事件的临时解决方法
  7. 在asp.net中捕获href事件
  8. JQuery标签输入插件ASP.NET不工作
  9. fullcalendar.js - 在按钮点击时删除事件

随机推荐

  1. OpenCV4Android中图像预览旋转90度的问题
  2. 如何将本机应用程序(android)与phonegap应
  3. 【Android学习】数据传递三种方式
  4. 说说Android的广播(4) - 前台广播为什么
  5. Android Studio 常见异常解决办法
  6. Android——性能优化相关文章
  7. Linux下 使用Repo和Git下载Android源代码
  8. Eclipse默认标签TODO,XXX,FIXME和自定义
  9. android 命令修改时间或程序修改系统时间
  10. 让Android 设备通过USB 转RJ45有线网卡上