gpt4 book ai didi

javascript - Angular Material md-toolbar/md-content 双滚动条

转载 作者:行者123 更新时间:2023-11-30 08:32:39 24 4
gpt4 key购买 nike

我在创建两个滚动条时遇到问题。我将 md-toolbar 用于我的导航(我希望始终将其固定在顶部)并使用 md-content 来保存我的内容。当我滚动时,导航会停留在顶部,但会创建一个额外的滚动条。 (见图片右侧有两个滚动条)

see double scroll to right

这是我的 index.html:

<body ng-cloak ng-app="TrooNews" ng-controller="AppController as app">

<!--top toolbar-->
<md-toolbar class="md-shadow-bottom-z-1">
<div class="md-toolbar-tools">
<md-button class="md-icon-button" ng-click="app.toggleSidenav('left')" hide-gt-md1 aria-label="Menu">
<md-icon>menu</md-icon>
</md-button>
<a href="/home"><h1>Troo News</h1></a>
<span flex></span>
<md-button class="md-icon-button" ng-click="" hide-gt-md1 aria-label="Search">
<md-icon>search</md-icon>
</md-button>
</div>
</md-toolbar>

<!--left sidenav-->
<div layout="row" layout-fill flex>
<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" md-component-id="left">
<md-toolbar></md-toolbar>
<md-content flex role="navigation">
<md-list>
<md-list-item ng-repeat="item in app.menu" ng-click="app.navigateTo(item.link)">
<md-icon>{{item.icon}}</md-icon>
<p>{{item.title}}</p>
</md-list-item>
</md-list>
</md-content>
</md-sidenav>
<div layout="column" layout-fill ng-viewport></div>
</div>

<div ng-view class="content"></div>

</body>

还有我的卡片 View 的 html:

<md-content class="container-fluid">
<section class="content-section">
<div layout="column" layout-align="center" ng-style="{'width': '100%'}">
<div class='md-padding' layout="row" layout-align="center" flex-offset-sm="0" flex-offset-md="0" flex-offset-lg="0" flex-offset-gt-lg="0" layout-wrap>
<md-card ng-repeat="article in home.articles">
<img ng-src="{{article.imagePath}}" class="md-card-image" alt="Test image">
<md-card-title>
<md-card-title-text>
<a href="/article/{{article.id}}"><span class="md-headline">{{article.title}}</span></a>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>
{{article.text}}
</p>
</md-card-content>
<md-card-actions layout="row" layout-align="end center">
<md-button class="md-icon-button" aria-label="Report">
<md-icon class="material-icons">report problem</md-icon>
</md-button>
<md-button class="md-icon-button" aria-label="Share">
<md-icon class="material-icons">share</md-icon>
</md-button>
</md-card-actions>
</md-card>
</div>
</div>
</section>
</md-content>

还有我的 CSS:

body {
background-color: #EEEEEE;
}

md-toolbar {
z-index: 100;
}

a {
text-decoration: none;
color: black;
}

a:hover {
color:#3F51B5;
}

md-card {
width:400px;
}

最佳答案

工具栏坚持 md-content 而不是 body -> 内部滚动条,就像 Angular Material 的网站一样,他们删除了主滚动条并使用: body { 溢出:隐藏; 最大宽度:100%; 最大高度:100%; } 并只保留内部的。

关于javascript - Angular Material md-toolbar/md-content 双滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35510487/

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