I have a dynamic listview built with knockout:
<ul class="menu-items-listview" id="items-list"
data-role="listview" data-bind="foreach: Items" >
<li class="menu-item">
<div class="menu-item-container">
<div class="menu-amount-container">
<a id="dec-button" data-bind="click:$root.decCount, visible:Count">-</a>
<span data-bind="text: Count, visible: Count" class="item-amount-counter"></span>
<a id="inc-button" data-bind="click:$root.incCount">+</a>
</div>
</div>
</li>
</ul>
On a desktop everything works fine. On a touch device each time after the listview is refreshed first tap on a #inc-button
or #dec-button
would fire twice. Then everything is ok until the listview is refreshed.
Clue 1: there are two iScroll divs on the page and it seems like it may cause the problem. There are issues on the forums concerning jQuery event subscription but not knockout bindings:
- https://github.com/cubiq/iscroll/issues/270
- How can I trouble shoot click events being triggered twice?
Clue 2: after the listview refresh if I touch the screen to scroll and then push the button the action is fired once
EDIT: it's definitely an iScroll issue. I disabled the iScroll script and the actions fire once as they should