I have downloaded iScroll.js and used in one of my phonegap project i.e.
<script type="application/javascript" src="iscroll.js"></script>
<script type="text/javascript">
var myScroll;
function loaded() {
myScroll = new iScroll('wrapper');
}
document.addEventListener('DOMContentLoaded', loaded, false);
</script>
It doesn't work on normal browsers too but when i inspect elements it started working absolutely fine?? don't know what the problem is...
don't define the height and width to inner div where content exists. and create object iScroll after content is dynamically rendered completely.
How to use iScroll
1) Need to prevent the default behavior of standard touch events. Easy to do this, by adding preventDefault() in your touchmove event.
2) Initialize the iScroll object on DOMContentLoaded or on window load.
Change your code to,
function loaded() {
document.addEventListener('touchmove', function(e){ e.preventDefault(); });
myScroll = new iScroll('wrapper');
}
document.addEventListener('DOMContentLoaded', loaded, false);
Hope it helped.
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