0

in a Web view I use this code for Zoom :

<body id='body'>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt u,...

    <script type="text/javascript" charset="utf-8">

        body = document.getElementById('body');

        // (in percents)
        zoom = 100;
        maxZoom = 200;
        minZoom = 50;
        zoomIncrement = 25;

        function gestureEnd(event) {
            var newZoom;
            if (event.scale > 1.0) {
                // increase size
                newZoom = zoom + zoomIncrement;
            } else {
                // decrease size
                newZoom = zoom - zoomIncrement;
            }

            // don't exceed zoom boundaries
            if (newZoom > maxZoom || newZoom < minZoom) {
                return;
            }
            zoom = newZoom;
            body.style.webkitTextSizeAdjust = zoom+"%";
        }

        body.addEventListener("gestureend", gestureEnd, false);

        </script>
    </body>

HOW CAN I HAVE FROM webview zoom variable value every pinch-event (to change the default value in the APP) ??

A sort of 'callback' method by JS to App..

ikanimo
  • 21
  • 2

1 Answers1

0

If you want to get the value of a JS variable to use in App native Obj-C, maybe you can use stringByEvaluatingJavaScriptFromString method.

erkanyildiz
  • 13,044
  • 6
  • 50
  • 73