Angular Material md-toolbar not sticking (md-scroll-shrink)

前端 未结 2 879
孤城傲影
孤城傲影 2021-01-26 18:49

I\'m using a on my page, but it\'s not sticking to the top when the user scrolls down (like in the scroll shrink demo).

<
相关标签:
2条回答
  • 2021-01-26 18:58

    Yes, there is a problem in your layout. I have done a little bit of restructure. see http://codepen.io/anon/pen/VabdzW

    <div ng-app="MyApp" layout="column" ng-controller="MainCtrl as main" ng-cloak layout-fill>
      <md-content flex layout="column">
        <md-toolbar flex="50">
                ...
        </md-toolbar>
    
        <div layout="row">
            <md-sidenav layout="column" class="md-sidenav-left" md-component-id="left" md-is-locked-open="$mdMedia('gt-sm')" layout-padding md-whiteframe="4">
                ..
            </md-sidenav>
            <md-content layout="column" layout-padding flex>
                ..real content
            </md-content>
          </div>
        </md-content>
    </div>
    
    0 讨论(0)
  • 2021-01-26 19:05

    check this example

    <div ng-app="MyApp">
     <div layout="column" ng-controller="MainCtrl as main" ng-cloak>  
     <md-sidenav md-component-id="left" class="md-sidenav-left" md-swipe-left="toggleSidenav()" >
      <md-menu-item>   
       menu  
      </md-menu-item>
    </md-sidenav>
    
    <md-content flex>   
    <md-toolbar>      
        <div class="md-toolbar-tools" >          
            <md-button class="md-icon-button" aria-label="Menu" ng-    click="toggleSidenav()">
                <md-icon>menu</md-icon>
            </md-button>
           <span flex>
               <a class="md-title" href="">H3 TiP</a>
               <span class="report-subtitle md-subhead">Sample Report</span>
           </span>          
        </div>     
    </md-toolbar>
    
    <md-content layout="column" layout-padding flex> content 
    </md-content>  
    </md-content></div></div>
    
    0 讨论(0)
提交回复
热议问题