html - Adding pinch-zoomable div image to a non-scalable viewport on mobile devices -
consider following viewport meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui" />
the content on page non-scalable , mobile responsive. sometimes, need overlay large image on top of it, , allow user pinch-zoom image.
#overlay_div { position: fixed; top: 0; left: 0; height: 100%; width: 100%; background-color: #dddddd; z-index: 550000; overflow: scroll; -webkit-overflow-scrolling: touch; } <div id="overlay_div"> <img src="largeimage.jpg" width="100%"> </div>
currently, aware of 2 possible options:
- programmatically change viewport meta allow user scaling (possible cross-browser implications, causes content underneath scale not desirable)
- use hammer.js manually handle pinch event , scale div/image accordingly (seems complex possible compatibility implications).
does know proper way this, cross-browser compatibility? hoping there may simple css solution.
thanks
in general go zoomable version @paulie_d recommended; use on of pages:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
here google´s recommendation.
if have no other choice, recommend open image in same browser tab/window meta
tag shown above , back link navigation. native pinch-zoom available.
this example such implementation (you need mobile user agent): https://m.notebooksbilliger.de/notebooks/hp+compaq+15+h024sg
Comments
Post a Comment