Search code examples
javascriptjqueryhtmlfirefox-os

onmousedown on a button not triggered in FirefoxOS application


My application is running perfectly under Firefox for desktop, but when I test the app on my ZTE Open C (Firefox OS 1.3) nothing append when the button is down, and the most annoying part is that onmouseup and onclick work perfectly!

I already tried to bind the event with jQuery but it doesn't work neither...

HTML:

<button id="0-0" onmouseup="game.release('0','0')" onmousedown="game.click()"></button>

Javascript:

Game.prototype.click = function()
{
   this.timer = window.setInterval(function(){game.time+=50;},50);
}

Game.prototype.release = function(x,y)
{
    if(game.time>200)
    {
        this.flag(x,y);
    }
    else
    {
       //some code here
    }
    game.time=0;
    clearInterval(this.timer);
}

Solution

  • I think the problem might be because Firefox OS triggers touch events.

    Try ontouchstart event in addition to onmousedown.