Permalink
Browse files

Merge pull request #13 from tomds/prevent-click

Add config option to automatically call preventDefault() on the onclick event
  • Loading branch information...
2 parents 778c050 + c338ab4 commit c6869640800307061a36d2d36940fff2350f886d @dotmaster committed Dec 1, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 touchable.js
View
@@ -330,6 +330,12 @@
}
+ if(typeof conf.preventClick!=='undefined'){
+
+ this.preventClick=conf.preventClick;
+
+ }
+
}
this.$elem.bind('touchstart', function(e){
@@ -344,7 +350,13 @@
});
this.$elem.bind('touchmove', touchmove);
this.$elem.bind('touchend', touchend);
+
+ if (this.preventClick) {
+ this.$elem.bind('click', function (e) {
+ e.preventDefault();
+ });
+ }
}
-})(jQuery);//end closure
+})(jQuery);//end closure

0 comments on commit c686964

Please sign in to comment.