【发布时间】:2016-07-19 20:29:31
【问题描述】:
我有一个场景,我需要单击 div,这将给我另一个 div 并进行一些转换,但问题是单击的 div 在转换 div 时被隐藏。我需要点击的div 与div 以相同的过渡效果滑动。以下是我尝试过的:
HTML:
<div id='outerdiv' ng-controller="MyCtrl" >
<div ng-click="myValue=!myValue">RIGHT</div>
<div id="one" class='animate-hide' ng-hide="myValue">
this is just a sample div
</div>
{{myValue}}
</div>
JS:
var app = angular.module("myApp1", ["ngAnimate"]);
app.controller("MyCtrl", function ($scope) {
$scope.myValue=true;
});
CSS:
.animate-hide {
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 2s;
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 2s;
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 2s;
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 2s;
line-height:20px;
opacity:1;
padding:10px;
border:1px solid black;
background:white;
position: absolute;
left: 0;
top: 10px;
}
.animate-hide.ng-hide {
left: -100%;
opacity:0;
padding:0 10px;
}
任何帮助将不胜感激。
【问题讨论】:
-
添加位置:相对;到 #outerdiv 并尝试将 (.animate-hide) top:10px 调整为 20px;
标签: css css-transitions css-animations