Frage

Im trying to create a pinch-zoomable image using iScroll library. It works fine with small images but when I use images bigger than the screen I cannot scroll through them (I can on desktop browsers, but not on mobile!).

This link takes to a live example of this.

War es hilfreich?

Lösung

I finally solved it myself. Turns out the sample iScroll provides initializes the scrolling div with document.addEventListener('DOMContentLoaded', loaded, false);, but when this event is fired images might not have been loaded so their size is reported as 0.

Simply replacing it with:

window.addEventListener('load', loaded, false);

fixes it.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top