TextArea ios 支持滑动
Ext.define('Sai.view.TextArea', {
extend: 'Ext.form.TextArea',
xtype:'scrollTextArea',
initialize: function() {
this.callParent();
this.element.dom.addEventListener(
Ext.feature.has.Touch ? 'touchstart' : 'mousedown',
this.handleTouchListener = Ext.bind(this.handleTouch, this),
false);
this.element.dom.addEventListener(
Ext.feature.has.Touch ? 'touchmove' : 'mousemove',
this.handleMoveListener = Ext.bind(this.handleMove, this),
false);
this.moveListenersAttached = true;
},
destroy: function() {
if (this.moveListenersAttached) {
this.moveListenersAttached = false;
this.element.dom.removeEventListener(
Ext.feature.has.Touch ? 'touchstart' : 'mousedown',
this.handleTouchListener,
false);
this.element.dom.removeEventListener(
Ext.feature.has.Touch ? 'touchmove' : 'mousemove',
this.handleMoveListener,
false);
this.handleTouchListener = this.handleMoveListener = null;
};
this.callParent();
},
handleTouch: function(e) {
this.lastY = e.pageY;
},
handleMove: function(e) {
var textArea = e.target;
var top = textArea.scrollTop <= 0;
var bottom = textArea.scrollTop + textArea.clientHeight >= textArea.scrollHeight;
var up = e.pageY > this.lastY;
var down = e.pageY < this.lastY;
this.lastY = e.pageY;
if((top && up) || (bottom && down)) e.preventDefault();
if(!(top && bottom)) e.stopPropagation();
}
});
分享到:
相关推荐
本文通过对 Sencha Touch 框架的介绍,使读者对该框架有一定的了解,并通过一些代码示例给用户更详细直观的对 Sencha Touch 框架功能的了解。 ExtJS ExtJS 是为 web 开发人员提供的基于 JavaScript 和 web 标准快速...
Sencha Touch开发的项目《般若人生》源码
sencha touch 应用案例 sencha touch 案例 一个完整的sencha touch 应用案例 移动WEB社区开发的日志案例 非常不错!
sencha touch 折叠list
MAC OS 下sencha touch +cordova 开发环境配置。可以将H5 hybird 应用打包成IOS 应用。
sencha touch 2.4.0最新版 原版包下载
sencha touch中文翻译文档,包含sencha touch入门基础和一些控件的使用说明
sencha touch cookbook 英文高清文字版 !
sencha touch list demo
Sencha Touch 2入门教程之MVC 讲解如何使用 Sencha Touch 2 mvc模式来开发一个登录界面
sencha touch动态加载组件及容器内容,防止加载时间过长的问题
sencha touch 是一个移动平台UI开发框架,可以实现各种绚丽的页面效果
这是我做的一个sencha touch 的项目,测试并能运行,希望对大家有帮助
sencha touch grid
《Sencha Touch 权威指南》陆凌牛著的源码包
sencha touch2移动开发框架,ajax获取数据
sencha touch sdk工具
sencha touch 2 实现的贪吃蛇 希望对大家有所帮助