IScroll 4 is not working properly

I downloaded iScroll.js and was used in one of my phonegap projects ie

<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 does not work in regular browsers, but when I check the elements that it started to work absolutely normal , I don’t know what the problem is ...

+5
source share
2 answers

How to use iScroll

1) It is necessary to prevent the behavior of standard touch events by default. It is easy to do this by adding preventDefault () to the touchmove event.

2) Initialize the iScroll object in DOMContentLoaded or when the window loads.

Change your code to,

    function loaded() {
        document.addEventListener('touchmove', function(e){ e.preventDefault(); });
        myScroll = new iScroll('wrapper');
}
document.addEventListener('DOMContentLoaded', loaded, false);

Hope this helped.

+2
source

div, . iScroll , .

+2

All Articles