Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable animation on md-tabs, angularjs material

The animation when switching tabs is so laggy. Makes my entire application unusable. A true show-stopper.

I've read many questions on the topic. Is it really total impossible to remove this animation?

https://material.angularjs.org/latest/api/directive/mdTabs

like image 578
Joe Avatar asked Nov 14 '17 18:11

Joe


People also ask

How to stop animation in mat tab?

Controlling the tab animation If you want to disable the animation completely, you can do so by setting the properties to 0ms . The duration can be configured globally using the MAT_TABS_CONFIG injection token.

What is MD in Angularjs?

The "md" stands for "Material Design", a specific UI look-and-feel developed by Google in 2014. These are not part of Angular itself, but part of a component library built in Angular: "a set of reusable, well-tested, and accessible UI components based on Material Design": https://material.angularjs.org/latest/

What is md tab?

mdTabs API Documentation. The <md-tabs> directive serves as the container for 1..n <md-tab> child directives. In turn, the nested <md-tab> directive is used to specify a tab label for the header button and optional tab view content that will be associated with each tab button.


1 Answers

Just add this line of css to disabled it: (PLUNKER)

/* This will disable the panel animation */
md-tabs [role="tabpanel"] {
    transition: none;
}

/* This will disable the `ink-bar` animation (border-bottom of selected tab) */
md-tabs md-ink-bar {
  transition: none;
}

Additionally, if you want to hide/remove the ink-bar (use display: none instead transition: none) and add custom style the selected tab...

md-tabs .md-active {
   font-weight: bold;
   /* Add your custom css styles to selected tab here */
}

** Tested and worked from angularjs-material versions > 1.0.0

like image 103
The.Bear Avatar answered Oct 30 '22 03:10

The.Bear