Skip to content

Instantly share code, notes, and snippets.

@st44100
Created June 12, 2012 13:14
Show Gist options
  • Save st44100/2917437 to your computer and use it in GitHub Desktop.
Save st44100/2917437 to your computer and use it in GitHub Desktop.
jQM cancel capturing vertical scroll in scroll view.
//Edit _handleDragStart function.
_handleDragStart: function(e, ex, ey)
{
// Stop any scrolling of elements in our parent hierarcy.
$.each(this._getScrollHierarchy(),function(i,sv){ sv._stopMScroll(); });
this._stopMScroll();
var c = this._$clip;
var v = this._$view;
if (this.options.delayedClickEnabled) {
this._$clickEle = $(e.target).closest(this.options.delayedClickSelector);
}
this._lastX = this._lastX ? this._lastX : 0;
this._lastY = this._lastY ? this._lastY : 0;
var dx = 0;
var dy = 0;
// 縦方向のスクロールをキャンセルのために移動距離を算出
dx = Math.abs(this._lastX - ex);
dy = Math.abs(this._lastY - ey);
this._lastX = ex;
this._lastY = ey;
this._doSnapBackX = false;
this._doSnapBackY = false;
this._speedX = 0;
this._speedY = 0;
this._directionLock = "";
this._didDrag = false;
// 縦方向のスクロールをキャンセル
if (dy > 20 || (dx < 2 && dx < dy) ) {
console.log(dx);
console.log(dy);
return true;
}
・・・・
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment