Skip to content

Instantly share code, notes, and snippets.

@Bengejd
Created February 10, 2019 21:01
Show Gist options
  • Save Bengejd/b191ca75f92beb50d1d0e009e80899e1 to your computer and use it in GitHub Desktop.
Save Bengejd/b191ca75f92beb50d1d0e009e80899e1 to your computer and use it in GitHub Desktop.
Push the screen up from the bottom, while maintaining a correct list order. Meant for chat pages mostly.
@mixin pushFromBottom() {
overflow: auto;
display: flex;
flex-direction: column-reverse;
}
...
.push-from-bottom-container {
@include pushFromBottom();
}
<div class="push-from-bottom-container"> <!-- This is the class that 'tricks' the html to think it's in reverse -->
<div class="message-container"> <!-- This undo's the reverse trick we played, and orders the messages correctly -->
<messages *ngFor="let m of messages"></messages> <!-- This is the message list that we're wanting to have properly order, but push from bottom. -->
</div>
</div
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment