Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 10
Registered: ‎10-07-2010
My Device: Not Specified

Re: preventing zoom on double tap <meta name="touch-event-mode" content="native"/> not working :/

Hi,

     i has been the same problem and i solved very easy with hammer.js (javascript library for multi-touch gestures)  download from eightmedia.github.io/hammer.js/

 This is my code, work great, and easy in 2 steps

1- add the hammer library <script src="js/hammer.js" type="application/javascript"></script>

 

2- add the magic script 


window.addEventListener('load', function() {
var element = document.getElementById('canvas');
var hammertime = Hammer(element).on("doubletap", function(event) {
event.gesture.preventDefault();
})

}, false);

 

If you've been helped click on Like Button

 

New Contributor
Posts: 8
Registered: ‎11-05-2013
My Device: z10
My Carrier: telcel

Re: preventing zoom on double tap <meta name="touch-event-mode" content="native"/> not working :/

ill give it a try!, it scrolls when I slide my finger across the screen, can this be fixed too?
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: preventing zoom on double tap <meta name="touch-event-mode" content="native"/> not working :/

Sure thing, fire it along to eoros@blackberry.com


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Contributor
Posts: 10
Registered: ‎10-07-2010
My Device: Not Specified

Re: preventing zoom on double tap <meta name="touch-event-mode" content="native"/> not working :/

for scroll problem try this script, work fine form me 

 

document.addEventListener('touchmove', function(e)
{
e.preventDefault();
window.scroll(0,0);
return false;
}, false);

 

and for prevent zoom with open two fingers on screen change window.scroll for window.zoom

 

If you've been helped click on Like Button

Highlighted
New Contributor
Posts: 8
Registered: ‎11-05-2013
My Device: z10
My Carrier: telcel

Re: preventing zoom on double tap <meta name="touch-event-mode" content="native"/> not working :/

hi there guys, i have solved the problem with your help, to prevent screen scrolling i used this:

 

document.addEventListener('touchmove', function(e)
{
e.preventDefault();
window.scroll(0,0);
return false;
}, false);

 

and for preventing the double  tap zoom, i used a meta viewport var, my entire script is this:

 

 

 <script>
             var meta = document.createElement("meta");
             meta.setAttribute('name', 'viewport');
             meta.setAttribute('content', 'initial-scale=' + (1 / window.devicePixelRatio) + ',user-scalable=no' + ',');
             document.getElementsByTagName('head')[0].appendChild(meta);

             document.addEventListener('touchmove', function (e) {
                 e.preventDefault();
                 window.scroll(0, 0);
                 return false;
             }, false);
        </script>

 

 TNKS  zayrus and oros