Search code examples
javascriptcsswindows-phone-7windows-phone-8

How to set -ms-touch-action: none; using javascript


In a Windows Phone app I want to overwrite the default touch actions on the browser window so the events instead gets handled by the javascript.

From what I can read this can be done by setting -ms-touch-action: none; in the CSS of the homepage.. Unfortunately I can't change the CSS so instead I'm looking for a way to set -ms-touch-action: none; using the Invokescript javascript function of the browser..

Is this possible??

Thanks


Solution

  • Using only JavaScript you could do it like this:

    var elem = document.getElementById("elem"); //body or what element you want.
    elem.setAttribute("style","-ms-touch-action: none;");