- if (!this.moved) {
- /* iOS4 では touchStart イベントは preventDefault() してないので
- click イベントを発生させちゃうと 2重にクリックが発生したような
- 状態になるので、スルーでいい */
- if (!navigator.appVersion.match(/iPhone OS 4/)) {
- // Find the last touched element
- var theTarget = e.changedTouches[0].target;
- if (theTarget.nodeType == 3) {
- theTarget = theTarget.parentNode;
- }
- // Create the fake event
- var theEvent = document.createEvent('MouseEvents');
- theEvent.initMouseEvent("click", true, true, document.defaultView,
- e.detail, e.screenX, e.screenY, e.clientX, e.clientY,
- e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
- e.button, e.relatedTarget);
- theTarget.dispatchEvent(theEvent);
- return false;
- }
- return true;
- }
-
- var time = e.timeStamp - this.scrollStartTime;
-
- var momentumX = this.scrollX === true
- ? this.momentum(this.x - this.scrollStartX,
- time,
- this.options.bounce ? -this.x + this.scrollWidth/4 : -this.x,
- this.options.bounce ? this.x + this.element.offsetWidth - this.scrollWidth + this.scrollWidth/4 : this.x + this.element.offsetWidth - this.scrollWidth)
- : { dist: 0, time: 0 };
-
- var momentumY = this.scrollY === true
- ? this.momentum(this.y - this.scrollStartY,
- time,
- this.options.bounce ? -this.y + this.scrollHeight/4 : -this.y,
- this.options.bounce ? this.y + this.element.offsetHeight - this.scrollHeight + this.scrollHeight/4 : this.y + this.element.offsetHeight - this.scrollHeight)
- : { dist: 0, time: 0 };
-
- if (!momentumX.dist && !momentumY.dist) {
- this.resetPosition();
- return false;
- }
-
- var newDuration = Math.max(Math.max(momentumX.time, momentumY.time), 1); // The minimum animation length must be 1ms
- var newPositionX = this.x + momentumX.dist;
- var newPositionY = this.y + momentumY.dist;
-
- this.element.addEventListener('webkitTransitionEnd', this);
-
- this.scrollTo(newPositionX, newPositionY, newDuration + 'ms');
+ if (that.options.momentum) {
+ momentumX = that.scrollX === true
+ ? that.momentum(that.x - that.scrollStartX,
+ time,
+ that.options.bounce ? -that.x + that.scrollWidth/5 : -that.x,
+ that.options.bounce ? that.x + that.scrollerWidth - that.scrollWidth + that.scrollWidth/5 : that.x + that.scrollerWidth - that.scrollWidth)
+ : { dist: 0, time: 0 };
+
+ momentumY = that.scrollY === true
+ ? that.momentum(that.y - that.scrollStartY,
+ time,
+ that.options.bounce ? -that.y + that.scrollHeight/5 : -that.y,
+ that.options.bounce ? (that.maxScrollY < 0 ? that.y + that.scrollerHeight - that.scrollHeight : 0) + that.scrollHeight/5 : that.y + that.scrollerHeight - that.scrollHeight)
+ : { dist: 0, time: 0 };
+
+ newDuration = Math.max(Math.max(momentumX.time, momentumY.time), 1); // The minimum animation length must be 1ms
+ newPositionX = that.x + momentumX.dist;
+ newPositionY = that.y + momentumY.dist;
+ }