最近在项目中发现 sencha touch 中的 textarea 在手机上不显示滚动条,也不能滚动。

在浏览器中之所以能显示滚动条滚动,那是浏览器为 textarea 添加的滚动条。 但在手机中是不会显示滚动条的。 可能在以后的版本中会有所改进吧。

于是只能另想办法了,找了一个老外重写的可滑动的 textarea (无滚动条)。

转:

Ext.define('LeslieTest.view.TextArea',
{
extend : 'Ext.field.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();
}
});

  

最新文章

  1. 常用SQL
  2. UGUI研究院之控件以及按钮的监听事件系统
  3. c程序中出现segment error 和 bus error 的原因
  4. IOS UISearchDisplayController 点击搜索出现黑条问题解决方案
  5. Zxing二维码重复扫描,不退出。
  6. IOS事件处理机制(关于触发者和响应者的确认)
  7. 云之讯融合通讯开放平台_提供融合语音,短信,VoIP,视频和IM等通讯API及SDK。
  8. Activity singleTop启动模式
  9. HDU 5059 Help him
  10. chrome开发工具指南(六)
  11. Ubuntu Mininet环境搭建
  12. 《java入门第一季》之tcp协议下的网络编程c/s实现通信交互
  13. WinForm 国际化的一些问题
  14. Redis入门之增删改查等常用命令总结
  15. Doctrine2-基础概念
  16. mint-ui Toast icon 图标
  17. python 生成器、列表解析式、yield、迭代器
  18. Python4 - 文件操作
  19. Session.Abandon和Session.Clear的实现和区别
  20. Spring4总结

热门文章

  1. js防windos锁屏功能实现
  2. Android-看操作系统短信应用源码-隐式意图激活短信界面
  3. Postgres数据库在Linux中优化
  4. Centos7 因内存 可用大小不足,被killed的解决办法
  5. 一些参考网站 - Reference Documentation - Website Address
  6. Elasticsearch(1.1.1)基础教程pdf
  7. jenkins+checkstyle
  8. C# 编写的SqlServer 数据库自动备份服务,带配置,功能强大
  9. element-ui学习
  10. day03.2-内置函数的使用