gpt4 book ai didi

css - 水平 ionic 卷轴不起作用

转载 作者:搜寻专家 更新时间:2023-10-31 22:20:07 25 4
gpt4 key购买 nike

在我正在制作的元素中,我使用了 ion-scroll 两次并且工作完美(垂直模式)但现在我正在尝试进行水平滚动并且不起作用,滚动出现但我无法滚动任何内容。

HTML代码很简单:

<ion-scroll direction="x" class="box">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</ion-scroll>

和 CSS:

.box {
width: 60vw;
height: 10vh;
border: 1px solid black;
}

.box > * {
display: inline-block;
margin-right: 4vw;
width: 20vw;
height: 10vh;
background: red;
}

有什么建议吗?我做错了什么?我错过了什么?

提前致谢

最佳答案

查看此 codepen example ,对其进行编辑并将其更改为您的风格。

angular.module('ionicApp', ['ionic'])

.controller('MainCtrl', ['$scope', function($scope) {
$scope.data = {
isLoading: false
};


}]);
.wide-as-needed {
overflow: scroll;
white-space: nowrap;
}
.scroll {
min-width: 100%;
}
.bar.bar-loading {
display: block;
height: 24px;

/* starts right below a normal header */
top: 44px;

/* make the text centered vertically and horizontally */
text-align: center;
padding: 0;
line-height: 24px;

/* transition 'sliding down' (check below)*/
-webkit-transition: 200ms all;
}


/*
* make the content's top changes animate.
* might not always look good, but looks
* good when our loader is added & removed
*/
.has-header {
-webkit-transition: 200ms top;
}
.has-header.has-loading {
/* 44px (header) + 24px */
top: 68px;
}

/* make loading bar slide up/down */
.bar-loading.ng-enter,
.bar-loading.ng-leave.ng-leave-active {
height: 0;
border-width: 0px;
}
.bar-loading.ng-enter.ng-enter-active,
.bar-loading.ng-leave {
height: 24px;
border-width: 1px;
}
<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-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-header-bar>
<div class="bar bar-loading bar-assertive" ng-if="data.isLoading">
Loading...
</div>
<ion-content ng-class="{'has-loading': data.isLoading}">
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
</ion-content>

</body>
</html>

关于css - 水平 ionic 卷轴不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28587396/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com