I'm using iScroll to create a web app and I'm unable to click any divs that are within the iscroll wrapper. I tried setting eventPassthrough option to be true but it causes a significant amount of scrolling problems.
Anyone experienced this?
Edit: I'm using iScroll 5. The click events work chrome,firefox, and safari but not ios mobile safari.
Try setting the option "click: true"
example:
myScroll = new IScroll('#wrapper', { click: true });
I had the same problem on IOS6 and it fixed the issue
I also ran into the same problem and began using the { click: true }
approach (indicated above) as a solution. The problem with this approach is you will get two click events firing when viewed on the desktop (i.e. one event from actual mouse click, and one event from IScroll).
The suggested approach per the IScroll documentation is to emit a custom 'tap' event using the IScroll options.
Example:
<script type="text/javascript">
var scroller = new IScroll('#wrapper', { tap: true });
$('#scroller').on('click, tap', '.clickable', function() {
//do something....
});
</script>
<div id="wrapper">
<div id="scroller">
<div class="clickable"></div>
<div class="clickable"></div>
<div class="clickable"></div>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With