javascript - Mousedown not working on Iphone? -
i try make mousedown function work on ios cant seem fix issuse. know problem code below greatful!
bindinteractions: function(){ // bind interactions used during live play this.playfield.on('mousedown','touchstart', _.throttle(_.bind(function(event){ this.firegun(); var weaponspread = this.player.getweapon().getspread(); if(weaponspread <= 0) { console.error("zero spread weapons can no damage. recommended minimum size: 25"); } var playfieldoffset = $(event.delegatetarget).offset(); var location = { top: event.pagey - playfieldoffset.top, left: event.pagex - playfieldoffset.left }; $.each(this.liveducks, function(i,duck){ duck.shotsfired(location, weaponspread); }); },this), this.player.getweapon().getreloadtime())); this.showlevelinfo(); }, unbindinteractions: function(){ // unbind interactions should not available during transitions , other non live play states this.playfield.off('mousedown','touchstart'); $.each(this.liveducks, function(i, duck) { duck.unbindevents(); });
according jquery documentation .on()
.on( events [, selector ] [, data ], handler )
events
type: string 1 or more space-separated event types , optional namespaces, such "click" or "keydown.myplugin".
it says one or more space-separated event types
.
so maybe mousedown
and touchstart
should in same string parameter :
this.playfield.on('mousedown touchstart', _.throttle(_.bind(function(event){ }
Comments
Post a Comment