Home > Software engineering >  How to position a div based on the position of the page?
How to position a div based on the position of the page?

Time:12-31

I saw it on a site called Medium.com and I want to make it on my website too.

When the shared post is at the top of the page =

first.image

When the shared post is at the bottom of the page =


second.image

I will make this in angular. I hope I have made my request clear.

CodePudding user response:

I would suggest to use Angular Material Menu which looks similar and handels the positioning of the dropdown and is supported by the Angular Material Team.

    <button mat-icon-button [matMenuTriggerFor]="menu" aria-label="Example icon-button with a menu">
  <mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
  <button mat-menu-item>
    <mat-icon>dialpad</mat-icon>
    <span>Redial</span>
  </button>
  <button mat-menu-item disabled>
    <mat-icon>voicemail</mat-icon>
    <span>Check voice mail</span>
  </button>
  <button mat-menu-item>
    <mat-icon>notifications_off</mat-icon>
    <span>Disable alerts</span>
  </button>
</mat-menu>
  • Related