简体   繁体   English

无法让AnimationJS与AngularJS一起使用

[英]Can't get animationjs to work with AngularJS

I'm trying to add ngAnimate to my code, but it doesn't work... And I'm totally lost. 我试图将ngAnimate添加到我的代码中,但是它不起作用...而我完全迷路了。 I would like the be between the 2 tabs in the footer. 我希望在页脚的2个标签之间。 So the page starts on tab 1 and when you click on tab 2 I would like to show the content with an animation. 因此,页面从选项卡1开始,并且当您单击选项卡2时,我想用动画来显示内容。 Can anyone help me?? 谁能帮我?? (I've already linked the script sources angularJs and the animation script at the top of my body (我已经将脚本源angularJs和动画脚本链接到了我的身体顶部。

so the first two sentences are: 
<script src="javascript/angular.min.js"></script>
<script src="javascript/angular-animate.min.js"</script> 

but that's not the problem...) 但这不是问题...)

html: 
<div id="container" ng-controller="todoCtrl">

<!-- de controller die de gemaakt todo's weergeeft in de eerste tab -->
<div ng-show="tab === 1">
        <ul class="dots">
            <li ng-repeat="todo in todos | orderBy:'date':true">
                <input type="checkbox" ng-model="todo.done" />
                <span> {{todo.date | date: 'fullDate'}} <br> </span>
                <span ng-class="{'done':todo.done}">{{todo.title}} <br><br></span>
            </li>
        </ul><br>
    <button ng-click="clearCompleted()">Clear post</button>
</div>
<!-- tweede controller die het getypte submit naar het overzicht -->
<div ng-show="tab === 2">
    <p> Write to me: </p>
    <form name="frm" ng-submit="addTodo()">
        <textarea rows="20" cols="100" placeholder="Today was..." name="newTodo" ng-model="newTodo" required > </textarea><br><br>
        <button class="btn" ng-disabled="frm.$invalid">Enter post</button>
    </form>
    <br>
</div>
</div>
<footer>
    <section ng-init="tab = 1">
        <ul class="nav">
            <li> <a href ng-click="tab = 1"> Summary </a> </li>
            <li> <a href ng-click="tab = 2"> Add Diary post </a> </li>
        </ul>
    </section> 
</footer>


Javascript: 
    <script> 
<!-- hier maak je de module aan voor angular en aciveer je in de html tag --> 
    angular.module('To_Do',['storageService', 'ngAnimate']).
    <!-- controleren of de todos kloppen -->
    controller('todoCtrl',['$scope','getLocalStorage', function($scope, getLocalStorage){
        $scope.todos = getLocalStorage.getTodos();
        [
        <!--        {'title' : 'Build a todo app', date: $scope.today, 'done':false} -->            
        ];
        <!-- nieuwe item toevoegen aan local storage -->

css: 
.ng-hide-remove { 
animation:0.5s lightSpeedOut ease;
}


@keyframes lightSpeedOut {
0% {
opacity: 1;
}

100% {
transform: translate3d(100%, 0, 0) skewX(30deg);
transform: translate3d(100%, 0, 0) skewX(30deg);
transform: translate3d(100%, 0, 0) skewX(30deg);
opacity: 0;
}
}

Here is your animation but without keyframes: 这是您的动画,但没有关键帧:

.page.ng-hide-add,
.page.ng-hide-remove
{
    -webkit-transition: 2000ms ease all;
    -moz-transition: 2000ms ease all;
    -ms-transition:2000ms ease all;
    -o-transition: 2000ms ease all;
    transition: 2000ms ease all;
}

.page.ng-hide-remove  {
    opacity:0
}

.page.ng-hide-remove.ng-hide-remove-active {
    opacity:1
}

.page.ng-hide-add  {
    left: 0;
    -webkit-transform:  skewX(0deg);
    -moz-transform:skewX(0deg);
    -o-transform : skewX(0deg);
    transform:  skewX(0deg);
    opacity:1
}

.page.ng-hide-add.ng-hide-add-active{
    left: 100%;
    -webkit-transform: skewX(30deg);
    -moz-transform:skewX(30deg);
    -o-transform : skewX(30deg);
    transform:  skewX(30deg);
    opacity:0
}


.page{
    position:absolute;
    left:0;
    width 100%;
}

.container{
    position: relative;
    height:40px;
}

i made you a jsfiddle http://jsfiddle.net/s2ygrya6/ 我给你做了一个jsfiddle http://jsfiddle.net/s2ygrya6/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM