【发布时间】:2017-01-04 06:35:12
【问题描述】:
我有第一个弹出窗口,另一个弹出窗口来选择几个字段。 为了显示第二个弹出窗口,这是我正在尝试的代码:
$("#select1").click(function(e) {
e.stopPropagation();
//$('#sellerModal').hide();
var tmplData = {
string:['Ready','2-3 Days','4-5 Days','1 Week','10+ Days']
};
$("#countTypePopupTemplate").tmpl(tmplData).appendTo(".maindiv");
that.closePopup();
$("#count_div").each(function() {
$("#count_div").click(function(evt) {
evt.stopPropagation();
$("#select1").text($(this).text());
$("#myCounttype").remove();
});
});
});
这是 HTML 模板:
<script id="countTypePopupTemplate" type="text/x-jquery-tmpl">
<div id="myCounttype" class="popup1 layer-2">
<div class="popup5">
{{each string}}
<div id="count_div" class="popup4 bottom-border">${$value}</div>
{{/each}}
</div>
</div>
</script>
我收到警告:
Ignored attempt to cancel a touchstart event with cancelable=false, for example, because scrolling is in progress and cannot be interrupted. fastclick.js
在这里,我无法在第二个弹出窗口中单击 5 个元素中的 4 个。只有前 1 个是可点击的。 第二个弹出窗口的快照。
我阅读了所有讨论该主题的博客。但是没有任何解决方案适合我。看起来有一些角落案例。
【问题讨论】:
-
尝试使用jquerymobile.com将
click事件更改为touchstart -
我也试过了...没用...感谢您的回复
-
你的
each函数只是指向id的按钮,这导致你不能点击其他按钮,尝试使用class和@987654332 @在each。例如$(".pop_btns").each(function(){$(this).click(function(){ alert($(this).text()); })}); -
如果您使用手机进行调试,请尝试在您的计算机上使用 chrome (android) 或 safari (iOS)。铬:developers.google.com/web/tools/chrome-devtools/… Safari:moduscreate.com/enable-remote-web-inspector-in-ios-6
-
这对你有用吗?
标签: javascript jquery html cordova fastclick.js