单击不触发 IE Edge 中的模态
Click not triggering for modal in IE Edge
我无法仅在 Microsoft Edge 中打开模式。
打开模态的link是:
<%= link_to the_path, class: "btn btn-tertiary class-used-to-find-the-link", data: {"things-id" => 4, "other-things-id" => 7} do %>
<span>The Link's Text</span>
<% end %>
link 的 JavaScript 是:
$('class-used-to-find-the-link').click(onClick);
上面提到的onClick
方法类似于:
onClick = function(event) {
//blah..blah...blah
};
.click
不仅在 IE Edge 中触发,而且在所有其他浏览器中都有效。上面的 link 应该会打开一个模式。我有其他 .click
的实例,它们不打开模态,这些都很好。
所以,我认为这可能与这里的讨论有关:Microsoft Edge: onclick event stops working?。与 post linked 类似,当我刷新页面时,link 确实起作用并且模式打开。
此外,如果我首先打开包含 link 的页面并单击另一个选项卡,通过右键单击和 'Open In New Tab',那么 link 也将起作用。
我已经尝试了 post 我已经 link 编辑的一些答案,包括 mousedown
和 mouseup
但这些都没有用。
感谢任何帮助。
这是由 Turbolinks 引起的,与此处的 SO 问答无关:Microsoft Edge: onclick event stops working?. So, in a way the comment of the link here: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5782378/ 有效。
我以同样的方式和答案禁用了 Turbolinks:
具体来说,问题是由 turbolinks 和事件处理程序的结合方式引起的。禁用 Turbolinks 的替代方法是使用委托事件处理。这里有一篇关于委托事件处理程序的好文章:https://www.iexposure.com/industry-insights/rails-4-turbolinks-and-delegated-event-handling-in-jquery.
我无法仅在 Microsoft Edge 中打开模式。
打开模态的link是:
<%= link_to the_path, class: "btn btn-tertiary class-used-to-find-the-link", data: {"things-id" => 4, "other-things-id" => 7} do %>
<span>The Link's Text</span>
<% end %>
link 的 JavaScript 是:
$('class-used-to-find-the-link').click(onClick);
上面提到的onClick
方法类似于:
onClick = function(event) {
//blah..blah...blah
};
.click
不仅在 IE Edge 中触发,而且在所有其他浏览器中都有效。上面的 link 应该会打开一个模式。我有其他 .click
的实例,它们不打开模态,这些都很好。
所以,我认为这可能与这里的讨论有关:Microsoft Edge: onclick event stops working?。与 post linked 类似,当我刷新页面时,link 确实起作用并且模式打开。
此外,如果我首先打开包含 link 的页面并单击另一个选项卡,通过右键单击和 'Open In New Tab',那么 link 也将起作用。
我已经尝试了 post 我已经 link 编辑的一些答案,包括 mousedown
和 mouseup
但这些都没有用。
感谢任何帮助。
这是由 Turbolinks 引起的,与此处的 SO 问答无关:Microsoft Edge: onclick event stops working?. So, in a way the comment of the link here: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5782378/ 有效。
我以同样的方式和答案禁用了 Turbolinks:
具体来说,问题是由 turbolinks 和事件处理程序的结合方式引起的。禁用 Turbolinks 的替代方法是使用委托事件处理。这里有一篇关于委托事件处理程序的好文章:https://www.iexposure.com/industry-insights/rails-4-turbolinks-and-delegated-event-handling-in-jquery.