0

I have a setup where my scrollable container takes the full width and height of the viewport. I use iScroll to scroll the content over a background image. Works fine so far and I didn't find a better solution to have a fixed background image (any ideas would be awesome :) ). The problem is, that I can't zoom into the page anymore, cause iScroll disables it for the scrollable container, which is in this case the whole screen. Is there a way to get the native zoom feature back? I would also take a "desperate" solution which modifies the iScroll library or even another library for scrolling.

insertusernamehere
  • 23,204
  • 9
  • 87
  • 126

2 Answers2

0

For most mobile you won't be able to get the native zoom since iScroll overrides the touchstart and touchmove events. You can however have the simulated version of it by turning on the zoom option.

From the documentation :

var myScroll = new iScroll('wrapper', { zoom: true });
HoLyVieR
  • 10,985
  • 5
  • 42
  • 67
  • Thanks for your answer. I already tried it, but it doesn't zoom anything at all. And I thought that this will only zoom the scrollable and not the entire page. – insertusernamehere Jul 01 '12 at 15:03
  • @insertusernamehere Does the zoom at least work for you in the demo they provide in the documentation ? – HoLyVieR Jul 01 '12 at 15:10
  • Yeah, it works in the demo, but it's jumpy, means: you zoom, you see the result, you take off the finger, it does some recalculating and than re-renders the view (tested on iPad 3 with iOS 5.1) – insertusernamehere Jul 01 '12 at 15:17
  • @insertusernamehere Well as for the result it's probably the best you can get, because it's still zoom emulation. If it doesn't work the same way in your page, there probably is something in your page that is the problem. It's a little hard to say what it is without seeing anything. – HoLyVieR Jul 01 '12 at 15:29
  • I've found a "native" solution. But thanks again for your help and of course you're right, that it's still the best you can get for an emulation. – insertusernamehere Jul 02 '12 at 18:55
  • And I also found, that: a) the native solution is kind of buggy … b) that the zoom didn't work because I had `useTransform: false` set. So thanks again. But still to mention: iScroll zooms only the scrollable part, not the whole page. Which is of course fine for the purpose of this awesome library. – insertusernamehere Jul 06 '12 at 12:12
0

So I've found a pretty nice solution, which is built into iOS5:

overflow: scroll;
-webkit-overflow-scrolling: touch;

That did the trick for my case. No need for an extra scrolling library and it has the same features as before (momentum scrolling, resizing and so on).

insertusernamehere
  • 23,204
  • 9
  • 87
  • 126