Commit 5deeaaf0 authored by Nature's avatar Nature

fastClick长按事件

parent fb6005f8
...@@ -534,7 +534,7 @@ ...@@ -534,7 +534,7 @@
* @returns {boolean} * @returns {boolean}
*/ */
FastClick.prototype.onTouchEnd = function (event) { FastClick.prototype.onTouchEnd = function (event) {
var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement var forElement, trackingClickStart, targetTagName, scrollParent, touch, pointY, targetElement = this.targetElement
if (!this.trackingClick) { if (!this.trackingClick) {
return true return true
} }
...@@ -545,7 +545,15 @@ ...@@ -545,7 +545,15 @@
return true return true
} }
/**
* 页面长按添加键盘监听事件
*/
if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) { if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
if (targetElement.readOnly) return
if (targetElement.nodeName === 'INPUT' || targetElement.nodeName === 'TEXTAREA') {
pointY = event.changedTouches[0].clientY;
scollContent(pointY,targetElement)
}
return true return true
} }
...@@ -569,7 +577,7 @@ ...@@ -569,7 +577,7 @@
targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement
targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent
} }
var pointY = touch = event.changedTouches[0].pageY; pointY = event.changedTouches[0].clientY;
targetTagName = targetElement.tagName.toLowerCase() targetTagName = targetElement.tagName.toLowerCase()
if (targetTagName === 'label') { if (targetTagName === 'label') {
forElement = this.findControl(targetElement) forElement = this.findControl(targetElement)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment