我已经创建了jsfiddle http://jsfiddle.net/99vtukjk/点击左或右文本,目前的动画隐藏是向上的,我们如何才能改变它向左滑动动画,例如滑动和淡入左侧菜单栏?
<body ng-app="myApp1">
<div id='outerdiv' ng-controller="MyCtrl" >
<div ng-click="myValue=true" >LEFT</div>
<div ng-click="myValue=false">RIGHT</div>
<div id="one" class='animate-hide' ng-hide="myValue">
this is just a sample div
</div>
{{myValue}}
</div>
</body>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;
}
.animate-hide.ng-hide {
line-height:0;
opacity:0;
padding:0 10px;
}Angular模块
var app = angular.module("myApp1", ["ngAnimate"]);
app.controller("MyCtrl", function ($scope) {
$scope.myValue=false;
});发布于 2014-10-08 15:01:02
您可以在.animate-hide上设置left: 0
和.animate-hide.ng-hide上的left: -100%
下面是一个有效的fiddle
有一件事可以帮助你制作漂亮的动画,那就是使用Animate.css
animate.css是一组很酷、有趣且跨浏览器的动画,可供您在项目中使用。
发布于 2014-10-08 15:04:15
查看ngAnimate。太棒了。
DEMO
https://stackoverflow.com/questions/26249373
复制相似问题