baker icon indicating copy to clipboard operation
baker copied to clipboard

iPhone and Viewport

Open tekdope opened this issue 12 years ago • 8 comments

Hi guys, Viewport command doesn't seem to work on iPhone version. HTML width should adapt to device width like it does in safari but doesn't work once the page is displayed in Baker. (see screenshots).

screen shot 2013-08-08 at 21 04 37 screen shot 2013-08-08 at 21 04 26

tekdope avatar Aug 09 '13 04:08 tekdope

Make sure you delete the app from the simulator before you switch from iPad to iPhone. That usually solves it for me.

Simbul avatar Aug 09 '13 07:08 Simbul

Will try and let you know

tekdope avatar Aug 09 '13 17:08 tekdope

Still doesn't work, even after cleaning build, remove it from simulator. Display perfectly in Safari.

tekdope avatar Aug 10 '13 05:08 tekdope

The demo book we provide is made just for iPad, you can't use it as an example on iPhone. :)

If instead you are adding your media-queries, you should post here the media queries you're using. :)

folletto avatar Aug 10 '13 17:08 folletto

Hi Folletto, my fault, i should be more clear on this. I modified the viewport settings to match the device width ( content="width=device-width;") to force the device to display the full page without having using media queries. Not working in Baker but fine with safari.

tekdope avatar Aug 10 '13 17:08 tekdope

Ok, now I understand. :)

The answer is equally simple. Baker uses scalesPageToFit to turn off zoom. This is because users don't expect a book to be zoomable, it must work at the intended resolution. You can override that property in book.json, but we strongly advise against it because it creates a bad experience for the reader.

The meta viewport parameter simply "forces" the page to use a specific page width, but that basically just works on the zoom level of the page (I'm simplifying a bit) and it's the same for the user as a zoomed book: a bad experience.

This means that you should not use viewport (other than force certain parameters if needed by your layout) and instead use the media-queries. This is the proper way to manage multiple-resolutions. For a broader explanation, search for responsive web design, that's the specific name of the design technique to be used. :)

folletto avatar Aug 10 '13 18:08 folletto

But that's the thing, i don't want people to zoom, just want to keep the same layout and shrink it on the fly :)

tekdope avatar Aug 10 '13 18:08 tekdope

That's not something possible. "Shrinking" means zooming, unless you use media-queries as said. :)

folletto avatar Aug 10 '13 19:08 folletto