Skip to content

Commit

Permalink
非タッチ端末にてnextPage/prevPageが動作しない場合がある不具合を解消
Browse files Browse the repository at this point in the history
  • Loading branch information
makog committed Sep 11, 2011
1 parent eba388d commit e4822b3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
9 changes: 6 additions & 3 deletions jquery.flicksimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
touchhold: false,

startX: null,
startY: null,
preX: 0,
currentX: 0,
flickX: 0,
Expand Down Expand Up @@ -184,6 +185,7 @@
var o = this;
var te = o.touchable ? event.changedTouches[0] : e;
o.startX = te.clientX;
o.startY = te.clientY;
o.touchhold = false;
var anc = e.target.tagName === 'A'
? $(e.target)
Expand Down Expand Up @@ -221,7 +223,7 @@
}
var te = o.touchable ? e.originalEvent.touches[0] : e;
var nowX = te.clientX;
if ( Math.abs( o.startX - nowX ) > 16 ) {
if ( Math.abs( o.startX - nowX ) > 16 || Math.abs( o.startY - te.clientY ) > 16 ) {
o.anc = null;
}
o.nextX = (o.currentX || 0) + ( nowX - o.startX );
Expand All @@ -239,8 +241,9 @@

touchend: function(e) {
var o = this;
// if ( o.startX === null ) { return; }
if ( o.startX === null ) { return; }
o.startX = null;
o.startY = null;
if ( o.anc && ! o.touchhold ) {
if ( $.isFunction( o.onClick ) ) {
o.onClick( o.anc );
Expand All @@ -258,7 +261,7 @@
location.href = link;
}
}
return false;
e.preventDefault();
}
o.touchhold = false;

Expand Down
23 changes: 12 additions & 11 deletions jquery.flicksimple.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e4822b3

Please sign in to comment.