scroll table content and fix the rest of the page - html
I'm using angular + angular material, but I think this question is more general. I have a sidenav to the left and in all the right I display a table with many rows, the problem is that if I try to scroll the table actually the whole page is scrolling, moving the sidenav as well. What I want is to scroll only the table and the rest to be fixed. I spent a lot of time but can't arrive to a solution.
thanks
This is the code, if you are not familiar with angular material, md-content as far as I know should be the same as a div element. layout="row" means that the children of this element should be positioned as a row.
<link rel="stylesheet" href="main/main.css">
<md-content layout="row">
<md-content>
<md-sidenav style="height: 100%" class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="true">
<md-toolbar style="min-height: 1px; height: 50px" class="md-theme-indigo">
<h3 class="md-toolbar-tools">Your Library</h3>
</md-toolbar>
<md-content layout="column" layout-padding flex>
<md-list>
<md-list-item class="md-1-line">
<md-button class="md-primary md-hue-1" ng-click="showSongs()">Songs</md-button>
</md-list-item>
<md-list-item class="md-1-line">
<md-button class="md-primary md-hue-1" ng-click="getArtists()">Artists</md-button>
</md-list-item>
<md-list-item class="md-1-line">
<md-button class="md-primary md-hue-1" ng-click="getAlbums()">Albums</md-button>
</md-list-item>
<md-list-item class="md-1-line">
<md-button class="md-primary md-hue-1">Playlists</md-button>
</md-list-item>
<md-divider ></md-divider>
<md-list-item class="md-1-line">
<md-button class="md-primary md-hue-1">Upload</md-button>
</md-list-item>
<md-list-item class="md-1-line">
<md-button class="md-primary md-hue-1">Download</md-button>
</md-list-item>
</md-list>
</md-content>
</md-sidenav>
</md-content>
<md-content layout="column" layout-padding flex>
<md-content ng-show="showSongsList">
<div ng-include="'main/songsList.html'"></div>
</md-content>
<md-content ng-show="showArtists">
<div ng-include="artistsTemplate.url"></div>
</md-content>
<md-content ng-show="showAlbums">
<div ng-include="albumsTemplate.url"></div>
</md-content>
</md-content>
</md-content>
<md-content ng-include="'navBar.html'"></md-content>
<md-content ng-include="'navBarBottom.html'"></md-content>
Basically the behaviour I'm looking for is something like this: http://codepen.io/zavoloklom/pen/dIgco selecting "Stacked on the left" in sidebar position dropdown, but this example is not for the library I'm using.
Well this might be the solution to your problem
the red div, consider it as your nav; which would be fixed
the green one could be the images div
.left {
float: left;
width: 100px;
height: 100vh;
background-color: red;
word-wrap: break-word;
position:fixed;
}
.right {
width: 300px;
float: right;
height: 300vh;
word-wrap: break-word;
background-color: green;
}
<div class="left">laksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnl</div>
<div class="right">,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas,sdfnlaksndklas</div>
Related
align image to left in angularjs html
You can see rows in picture. This is code of that view: <div layout="row" layout-align="space-around center" > <product-image-thumbnail layout="row" layout-align="left center" src="vm.callFunction(field)" setter="vm.callFunction(value)" /> <md-button ng-click="vm.onMouseOver(field.getSrc))" layout="row" layout-align="right center"> <md-icon>zoom_in</md-icon> </md-button> </div> I want to align image or uploadanimage to left, zoom button to right. But it doesnot work. i also tried layout-align="start start layout-align="end end" but it did not do the job. Also i tried buttons to convert to column but it is same. it makes two rows if i dont put first layout. i need them inside a row. this is where src image comes <div ng-show="!vm.src" layout="row"> <md-button class="md-button md-ink-ripple" ng-click="vm.Dialog($event)"> <md-icon>file_upload</md-icon> <span translate>upload_image</span> </md-button> </div> <div ng-show="vm.src" class="thumbnail" layout="column" layout-align="center center" flex layout-padding ng-click="vm.Dialog($event)"> <img src="{{vm.src}}" style="max-height: 60px;max-width: 60px" error-src="content/images/no_image_icon.gif" /> </div>
<p>This is some text. <img src="smiley.gif" alt="Smiley face" width="42" height="42" align="left"> This is some text.</p>
If you want to use angular material, try using the space-between param. Example Plunker. <div><!-- shouldn't need layout here--> <img layout="row" layout-align="space-between center" /> <button layout="row" layout-align="space-between center">Zoom</button> </div>
You can try this way, <section layout="row" layout-align="end center" layout-wrap> <div layout="row" layout-align="start center" flex> <img src="https://echtemaaltijd.blob.core.windows.net/image/image_671ed3d3-0c1e-43d5-9e9a-86247556fd00" class="md-card-image" alt="Washed Out"> <span flex></span> </div> <md-button class="md-warn">Type</md-button> </section> DEMO
Try this with flex! <div layout="row" layout-alignment="stretch"> <product-image-thumbnail flex src="vm.callFunction(field)" setter="vm.callFunction(value)" /> <md-button ng-click="vm.onMouseOver(field.getSrc))" flex="5"> <md-icon>zoom_in</md-icon> </md-button> </div> The flex Will take up as much space as it can till 95% of the available width and flex=5 will ensure it is 5$
Angular - Matierial Layout - how to set an image 50% of height of its parent (row-layout)
I am in trouble with angular material layout.. Got this: this one is just to show the whole html <div id="MainLayout" layout="column" flex style="height: 100%; overflow: hidden"> <div id="pageHeader" layout="row"> <div layout="column" flex> <div layout="row" flex> <img ng-repeat="icon in main.social" class="social" src="{{icon.path}}"/> </div> <div layout="row" flex></div> </div> </div> it is about this block: <div id="LogoDisplay" layout="row" flex="50" ng-style="main.styles.text" style="background: #F9F9F9"> <div layout="column" layout-align="center center" flex fill> <div id="LogoImage" layout="row" layout-align="center center"><img src="assets/images/user-foto-logo.png" style="???"></div> <div id="LogoTitle" layout="row" layout-align="center end">User Name</div> <div id="LogoText" layout="row" layout-align="center start">Job Title</div> </div> </div> and least I got this <div id="ImageDisplay" flex="50" layout="row" layout-align="center center"> <div ng-repeat="icon in main.icons">{{icon}}</div> </div> <div id="pageInfo" layout="row" style="background: #123; color: #FFFF88;">some info footage</div> I marked the code with ??? There is my problem, got 4 rows, row #1 gots some icons and #4 is just text... row 2 contains a logo and two rows of text row 3 contains a couple of logos My Problem: I would like to have rows 2 and 3 filling 50% of the height. the logo should take 50% of row 2 and the both texts should fit to width of the logo...
How to make md Content scrollable in Angular material Design
I am using ui-view in md-content to display a list but its getting overflow i want list in md-content should be scrollable here is my index.html <div layout-lt-lg="row" class="screen-bg"> <div flex-lt-lg="100"> <!--header--> <md-toolbar class="app-bar-bg" style="background-color: #9013fe;"> <div class="status-bar-bg"></div> <div class="md-toolbar-tools"> <md-button class="md-icon-button" aria-label="Settings"> <!--<md-icon md-svg-icon="app/images/back1.svg"></md-icon>--> </md-button> <h2> <span></span> </h2> <span flex=""></span> <md-button class="md-icon-button" aria-label="Favorite"> <!--<md-icon md-svg-icon="app/images/a.svg"></md-icon>--> </md-button> </div> </md-toolbar> <!--content--> <div> <md-content> <ui-view></ui-view> </md-content> </div> </div> </div> here is my template <md-list flex> <md-list-item class="md-3-line" ng-repeat="broadCast in broadCasts"> <div class="md-list-item-text" layout="column" > <h3>{{broadCast.name}}</h3> <h3>{{broadCast.phone}}</h3> </div> </md-list-item> </md-list>
To make the list scrollable: Add a class to md-list. <md-list class="make-scrollable" flex> <md-list-item class="md-3-line" ng-repeat="broadCast in broadCasts"> <div class="md-list-item-text" layout="column"> <h3>{{broadCast.name}}</h3> <h3>{{broadCast.phone}}</h3> </div> </md-list-item> </md-list> Style the md-list in your css file like so: md-list.make-scrollable { height: 600px; //Or any other height you wish overflow-y: scroll; } That should make the overflowing content scrollable
You are using too many unnecessary container elements. <div layout-lt-lg="row" flex-lt-lg="100" class="screen-bg"> <!--header--> <md-toolbar class="app-bar-bg" style="background-color: #9013fe;"> <div class="status-bar-bg"></div> //desired controller buttons <div class="md-toolbar-tools"></div> //desired controller buttons </md-toolbar> <!--content--> <md-content flex ui-view> </md-content> </div> Here is a working example. There are some changes but basic structure is almost same.
Center a div with flex = 33
Thank you for taking a look at my question. I have a div that is expanding across the page horizontally, which is what I want. I have 4 buttons in the div and I am using: <div layout="row" layout-align="space-around center" layout-sm="column" layout-fill layout-wrap > Which is good. However, it is taking up the whole div so the buttons look awkwardly spaced out. So I added flex="33" and now they are spaced out, but stuck in using only a third of the page which is what I want and it looks good. The issue I have is it is taking up the first third and I want it to use up the second third of the page. Is there a way to do this with out creating unnecessary divs to occupy the first third? Here is the complete code: <div flex="33" layout="row" layout-align="space-around center" layout-sm="column" layout-fill layout-wrap class="pageNavButtons"> <div ng-repeat="button in navPage" layout="column" layout-align="center center" style="color: #ffffff"> <label>{{button.div}}</label> <span></span> <md-icon md-svg-src="{{button.icon}}"></md-icon> </div> </div> I do not have any CSS with it yet. Images: Before flex=33 After adding it:
You can achieve that by either using flex-offset="33" or by adding layout-align="center" layout="row"on the parent. I would probably use the second one. <div div layout="row" flex-offset="33"> <div flex="33" layout="row" layout-align="space-around center" layout-sm="column" layout-fill layout-wrap class="pageNavButtons"> <div ng-repeat="button in navPage" layout="column" layout-align="center center" style="color: #ffffff"> <label> {{button.div}}</label> <span>----- </span> <md-icon md-svg-src ={{button.icon}}></md-icon> </div> </div> </div> or <div layout="row" layout-align="center"> <div flex="33" layout="row" layout-align="space-around center" layout-sm="column" layout-fill layout-wrap class="pageNavButtons"> <div ng-repeat="button in navPage" layout="column" layout-align="center center" style="color: #ffffff"> <label> {{button.div}}</label> <span>----- </span> <md-icon md-svg-src ={{button.icon}}></md-icon> </div> </div> </div> http://codepen.io/kuhnroyal/pen/mPVdRK
Angular Materail: Force footer to bottom
based on what I have below, can someone help me on how to make my footer stay to the bottom of my browser window if my main content does not have enough content. I don't want a sticky footer. There's gotta be an angular material way of doing this but I can't find it. Thanks! <body layout="column" > <md-toolbar > </md-toolbar> <div layout="row" flex> <md-sidenav class="md-sidenav-left md-whiteframe-z2 " flex > </md-sidenav> <md-content flex layout="row" layout-align="center start"> <div style="max-width: 1600px;" flex layout="column" layout-fill > <div > this is the main content </div> <div > this is the footer </div> </div> </md-content> </div> </body> here is jsfiddle
I hope this can help you. I added some classes to your html and applied these rules. .wrapper, div[layout=row] { height: 100%; } div[layout=column] { display: flex; min-height: 100vh; flex-direction: column; } .content { flex: 1; }