Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animating nebular sidebar component

I am using nebular sidebar component, what i'm trying to do is animating the opening and the closing of the sidebar. I checked the sidebar API but i didn't find anything that can do that ? I tried to apply css transition on the class but it didn't work, so how can i approach this ?

<nb-layout>

  <nb-layout-header subheader>
    <app-navbar style="width: 100%"></app-navbar>
  </nb-layout-header>

  <nb-sidebar [state]="'compacted'">
    <app-sidenav-menu></app-sidenav-menu>
  </nb-sidebar>

  <nb-layout-column>
    <router-outlet></router-outlet>
  </nb-layout-column>
</nb-layout>
like image 851
Ali Badr Avatar asked Nov 07 '18 14:11

Ali Badr


1 Answers

As I see it, the Nebular sidebar contains container inside:

<nb-sidebar>
  <div.main-container>
  ...
  </div>
</nb-sidebar>

And if you add transitions for both, sidebar and div.main-container it should provide the desired behavior.

nb-sidebar,
nb-sidebar > div.main-container {
  transition: width 1s;
}
like image 124
Nikita Poltoratsky Avatar answered Oct 31 '22 14:10

Nikita Poltoratsky