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

时间:2016-02-19 16:48:50

标签: javascript css angularjs angular-material

我的网站创建两个滚动条时出现问题。我正在使用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>

我的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;
}

1 个答案:

答案 0 :(得分:3)

工具栏坚持md内容而非身体 - &gt;内部滚动条和像角度材料的网站一样,他们删除主滚动并使用:     身体 {       溢出:隐藏;       最大宽度:100%;       最大高度:100%;     并且只保留内部的那个。