so touch devices have couple of event listeners touchstart
, touchmove
. else has events bound jquery, reason didn't work touch events bound using javascript:
document.addeventlistener('touchstart', this.touchstart); document.addeventlistener('touchmove', this.touchmove);
the problem when want trigger event jquery bound event, can use, example:
this.scrollcontainer();
however, context of this
different within javascript bound event means cannot trigger event way.
my question is, possible trigger event javascript bound event? if so, how?
you need use _.bind() pass custom context callback
document.addeventlistener('touchstart', _.bind(this.touchstart, this)); document.addeventlistener('touchmove', _.bind(this.touchmove, this));
Comments
Post a Comment