我有一个在移动设备上使用的应用。我有一个简单的水平滚动和一些文字。如果用户在水平滚动条之外向上或向下滑动,则页面上下滑动。但是,当用户用手指在水平滚动条内向上或向下手势时,页面不会向上或向下滑动。我希望它可以向上或向下滑动。以下是codepen。
这是代码。
<ion-scroll direction="x" class="wide-as-needed">
<a class="button inline-button">this is a button : 1</a>
<a class="button">this is a button : 2</a>
<a class="button">this is a button : 3</a>
<a class="button">this is a button : 4</a>
<a class="button">this is a button : 5</a>
<a class="button">this is a button : 6</a>
<a class="button">this is a button : 7</a>
<a class="button">this is a button : 8</a>
<a class="button">this is a button : 9</a>
<a class="button">this is a button : 10</a>
<a class="button">this is a button : 11</a>
<a class="button">this is a button : 12</a>
<a class="button">this is a button : 13</a>
<a class="button">this is a button : 14</a>
<a class="button">this is a button : 15</a>
<a class="button">this is a button : 16</a>
</ion-scroll>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
CSS
.wide-as-needed {
overflow: scroll;
white-space: nowrap;
}
.scroll {
min-width: 100%;
}
答案 0 :(得分:1)
您应该只能将overflow-scroll="true"
添加到<ion-content></ion-content>
代码中,以便它们显示如下:
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Ionic Modal</title>
<link href="http://code.ionicframework.com/nightly/css/ionic.min.css" rel="stylesheet">
<script src="http://code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
</head>
<body ng-controller="MainCtrl">
<ion-header-bar class="bar-positive">
<h1 class="title">Hello!</h1>
</ion-header-bar>
<ion-header-bar class="bar-subheader">
</ion-header-bar>
<div class="bar bar-loading bar-assertive" ng-if="data.isLoading">
Loading...
</div>
<ion-content overflow-scroll="true" ng-class="{'has-loading': data.isLoading}">
<ion-scroll direction="x" class="wide-as-needed">
<a class="button inline-button">this is a button : 1</a>
<a class="button">this is a button : 2</a>
<a class="button">this is a button : 3</a>
<a class="button">this is a button : 4</a>
<a class="button">this is a button : 5</a>
<a class="button">this is a button : 6</a>
<a class="button">this is a button : 7</a>
<a class="button">this is a button : 8</a>
<a class="button">this is a button : 9</a>
<a class="button">this is a button : 10</a>
<a class="button">this is a button : 11</a>
<a class="button">this is a button : 12</a>
<a class="button">this is a button : 13</a>
<a class="button">this is a button : 14</a>
<a class="button">this is a button : 15</a>
<a class="button">this is a button : 16</a>
</ion-scroll>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
</ion-content>
</body>
</html>
修改强>
可能找到了更好的功能性解决方案,虽然代码很多,但请参阅http://codepen.io/rajeshwarpatlolla/pen/xGWBja