Ng-mousedown and ng-mouseup do not work on mobile

I need to use ng-mousedown and ng-mouseup in my ionic mobile project. when the user clicks the icon and holds it pressed, ng-mousedown should change the icon to another, and with ng-mouseup it should transfer the user to the next page. Everything works fine in the browser, but not in the mobile phone (iPhone 6).

+4
source share
2 answers

Perhaps one of the following links will help you: ngTouch: https://docs.angularjs.org/api/ngTouch , the best alternative for ngClick ngTouchstart: https://github.com/nglar/ngTouchstart , instead of mousedown ngTouchend: https: / /github.com/nglar/ngTouchend instead of mouseup

+2
source

You can use the following code for a mobile phone as well as for a desktop. Please let me know.

$('body').bind( "touchstart mouseup", function(e){
        $('div#extras').fadeTo('fast', 1);
});

$('body').bind( "touchend mousedown", function(e){
        $('div#extras').delay(2000).fadeTo(1500, 0);
});
0
source

Source: https://habr.com/ru/post/1617072/


All Articles