我在用 angularJs 制作的 ionic 滚动元素中有 2 个表:
<ion-view>
<ion-scroll class="has-header has-footer" scrollbar-y="false" direction="y">
<div ng-controller="calendCtrl" >
<div id="t1" class="CSSTableGenerator" >
<table class="planner" isolateScrolling>
<tr ng-repeat="row in calendarData track by $index">
<td colspan="{{day.colspan}}" title="{{day.title}}"
ng-class="day.class"
ng-click="calendarCellClick($parent.$index,$index)"
ng-repeat="day in row track by $index">
{{day.descr}}
</td>
</tr>
</table>
</div>
<div id="t2" class="CSSTableGenerator" >
<table class="planner" isolateScrolling>
<tr ng-repeat="row in calendarData track by $index">
<td colspan="{{day.colspan}}" title="{{day.title}}"
ng-class="day.class"
ng-click="calendarCellClick($parent.$index,$index)"
ng-repeat="day in row track by $index">
{{day.descr}}
</td>
</tr>
</table>
</div>
<div>
</ion-scroll>
</ion-view>
这 2 个表真的很长,所以我需要一个溢出卷轴,但我需要一个 ionic 卷轴来查看两个表。
在 Chrome 浏览器上,如果我在鼠标指针位于第一个表格上时滚动,我可以滚动第一个表格,但 ion-scroll 元素也会滚动。
在 Safari 上,在 iPad 上我只能滚动 ionic ScrollView ,但我不能对表格做同样的事情。
我该如何管理?
更新 1
在 Firefox 和 Chrome 上 stopPropagation指令解决了双滚动行为,但 iPad 上的表格仍然无法滚动。
更新 2
我在长表单的选择输入元素中使用 iPad 滚动时遇到同样的问题,我可以滚动表单但不能滚动选择。
最佳答案
Ionic 1.2修复了有问题的浏览器滚动世界中的许多错误。
使用从 bower 安装的 1.2.4,现在一切都按照 aspected 的方式工作。
唯一对我不起作用的是不隐藏滚动条的属性 scrollbar-y="false"
。
下面是表格的css:
table.planner {
overflow-y: auto;
-webkit-overflow-scrolling: touch;
overflow-x: hidden;
}
它也适用于 overflow-y: scroll;
的 Safari iPad2。
关于javascript - 当我在表格元素上滚动时 ion-scroll 上的 stopPropagation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35022399/