gpt4 book ai didi

angularjs - 在路由转换angularjs之间滑动

转载 作者:行者123 更新时间:2023-12-03 23:26:23 25 4
gpt4 key购买 nike

我只使用 Angular 大约一个星期,所以如果我的代码是垃圾,我深表歉意。

我正在尝试在路由转换之间创建滑动操作。我可以在幻灯片中创建效果,但不能在路线转换之间创建效果。

无论如何代码如下:
导航

<li><a ng-click="go('/')"  class = "intro currentLink navLinks">Intro</a></li>
<li><a ng-click="go('/why')" class = "why navLinks">Why</a></li>
<li><a ng-click="go('/resume')" class = "resume navLinks">Res</a></li>
<li><a ng-click="go('/qualified')" class = "qualified navLinks">How</a></li>
<li><a ng-click="go('/contact')" class = "contact navLinks">Contact me</a></li>

View
<div class = "pages">
<div ng-view id="slides" ng-animate="'slide'">
<!--inside main view-->
</div><!--end main view-->
</div><!--end pages-->

css
.slide-leave-setup {
-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;
}
.slide-enter-setup {
-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;
}
.slide-enter-setup {
position: absolute;
left: 1300px;
}
.slide-enter-start {
left: 0;
}
.slide-leave-setup {
position: absolute;
left: -1700px;
}
.slide-leave-start {
right: 0;
}

包括
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-animate.min.js"></script>
<script src="http://code.angularjs.org/1.2.3/angular-route.min.js"></script>
<script src="http://code.angularjs.org/1.1.2/angular-sanitize.js"></script>
<script src="js/vendor/ui-bootstrap-custom-tpls-0.6.0.js"></script>

javascript:
var app = angular.module('MyApp', ['ui.bootstrap', 'ngSanitize', 'ngRoute', 'ngAnimate']);

完整项目在 https://github.com/arttay/blizz

谢谢

最佳答案

对于任何在谷歌上搜索这个的人......

将类 ng-enter/ng-leave/.ng-enter-active/.ng-leave-active 添加到您的 css 类。
例子

.slide-animate.ng-enter, .slide-animate.ng-leave{
-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;
}


.slide-animate.ng-enter.ng-enter-active {
position: absolute;
left: 1300px;
}

.slide-animate.ng-enter {
left: 0;
}

.slide-animate.ng-leave.ng-leave-active {
position: absolute;
left: -1700px;
}

.slide-animate.ng-leave {
right: 0;
}

Egghead.io如果您想要深入的教程,也有一些很棒的动画视频

关于angularjs - 在路由转换angularjs之间滑动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20272843/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com