Skip to content Skip to sidebar Skip to footer

Jquery Mouseup On Ios

I've recently added the jquery.mouse2touch.min.js plugin to my game, and after testing it out I ran into a problem. My movement system is made up of two divs (one to move the playe

Solution 1:

Working Fiddle

The issue with timer, you should clear-time-interval before move. Your global variable TimerWalk with clearInterval(TimerWalk); should be useful.

Here is the code block

$('#ios-left').mousedown(function () {
    clearInterval(TimerWalk);
    TimerWalk = setInterval(function () {
        processWalk('left');
    }, 100);
}).mouseup(function () {
    $div.stop();
    clearInterval(TimerWalk);
}).mouse2touch();

$('#ios-right').mousedown(function () {
    clearInterval(TimerWalk);
    TimerWalk = setInterval(function () {
        processWalk('right');
    }, 100);
}).mouseup(function () {
    $div.stop();
    clearInterval(TimerWalk);
}).mouse2touch();

This is only fix for proper movement, you may need to address other issues.


Post a Comment for "Jquery Mouseup On Ios"