最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Angular Material mdTabs - how to get only the effect of tabs animation not the content? - Stack Overflow

programmeradmin1浏览0评论

I want to get the animation effect of when someone clicks on the tab and the border below that tab slides to right with the button having a nice ripple effect. I don't want to use the content inside the tab, I just want the tab effect.

As you can see, clicking on the second tab will make the border slide to the right but content will also move to left. I only want tab button sliding to the right as part of my effect. How can I achieve this?

I want to get the animation effect of when someone clicks on the tab and the border below that tab slides to right with the button having a nice ripple effect. I don't want to use the content inside the tab, I just want the tab effect.

As you can see, clicking on the second tab will make the border slide to the right but content will also move to left. I only want tab button sliding to the right as part of my effect. How can I achieve this?

Share Improve this question edited Jan 5, 2016 at 17:28 serraosays 7,8693 gold badges38 silver badges68 bronze badges asked Aug 2, 2015 at 5:13 Piyush ChauhanPiyush Chauhan 1,5432 gold badges25 silver badges38 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 19

You can add this in styles

[role="tabpanel"] {
    transition: none;
}

You can use the md-tabs directive without the contents:

var app = angular.module('app', ['ngMaterial']);
app.controller('myController', function($scope) {
  $scope.selectedIndex = 0;
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular-aria.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/0.10.0/angular-material.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/0.10.0/angular-material.min.css">

<md-content ng-app="app" ng-controller="myController">
  <md-tabs md-dynamic-height md-border-bottom md-selected="selectedIndex">
    <md-tab label="one"></md-tab>
    <md-tab label="two"></md-tab>
    <md-tab label="three"></md-tab>
  </md-tabs>
  <div layout layout-align="center center">{{ selectedIndex }}</div>
</md-content>

发布评论

评论列表(0)

  1. 暂无评论