所以我有两组4个按钮。通过ng-show表达式一次只能看到一组按钮。我无法使用角度动画css在ng-show-add上创建幻灯片,并在ng-show-remove上滑出幻灯片。继承我的代码:
<script>
angular.module('myApp', ['ngAnimate']).
controller('theController', ['$scope', function($scope) {
$scope.imageAnalysis = false;
$scope.toggleImageBtns = function() {
$scope.imageAnalysis = !$scope.imageAnalysis;
};
}]);
<script>
<body>
<div class="container" ng-controller="theController">
<div class="row feature-btns" ng-show="imageAnalysis === false">
<div class="col-xs-3">
<div class="btn btn-default"> feature btn 1 </div>
</div>
<div class="col-xs-3">
<div class="btn btn-default"> feature btn 2 </div>
</div>
<div class="col-xs-3">
<div class="btn btn-default"> feature btn 3 </div>
</div>
<div class="col-xs-3">
<div class="btn btn-default" ng-click="toggleImageBtns()"> click me to see image buttons </div>
</div>
</div>
<!-- /.row -->
<div class="row image-btns" ng-show="imageAnalysis === true">
<div class="col-xs-3">
<div class="btn btn-default"> image btn 1 </div>
</div>
<div class="col-xs-3">
<div class="btn btn-default"> image btn 2 </div>
</div>
<div class="col-xs-3">
<div class="btn btn-default"> image btn 3 </div>
</div>
<div class="col-xs-3">
<div class="btn btn-default" ng-click="toggleImageBtns()"> go back to feature buttons </div>
</div>
</div>
</div>
</body
答案 0 :(得分:0)
这是一个CSS片段,它将从右侧滑动按钮。它应该让您了解需要使用和可以操作的类。
.feature-btns {
position: absolute;
top: 50px;
left: 0;
transition: 250ms ease-in-out all;
}
/* fade out content as it is hidden */
.feature-btns.ng-hide-add {
opacity: 1.0;
}
.feature-btns.ng-hide-add-active {
opacity: 0;
}
/* slide in from right*/
.feature-btns.ng-hide-remove {
left: 100%;
//left: 1100px;
position: absolute;
top: 50px;
}
.feature-btns.ng-hide-remove-active {
left: 0;
}
.image-btns {
position: absolute;
top: 50px;
left: 0;
transition: 250ms ease-in-out all;
}
/* fade out content as it is hidden */
.image-btns.ng-hide-add {
opacity: 1.0;
}
.image-btns.ng-hide-add-active {
opacity: 0;
}
/* slide in from right*/
.image-btns.ng-hide-remove {
left: 100%;
//left: 1100px;
position: absolute;
top: 50px;
}
.image-btns.ng-hide-remove-active {
left: 0;
}