cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              animation, body, button, div, html {
    border: 0;
    border-image-width: 0;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    margin: 0;
    outline: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    padding: 40px;
}

animation button {
    cursor: pointer;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    margin-right: 20px;
    padding: 10px;
}

/*
    The overflow property is set to hidden, so pages can be made hidden, by moving them outside of the list at the top or bottom.
*/
animation .list {
    border: 1px solid rgb(50, 50, 50);
    height: 90%;
    margin-top: 20px;
    overflow: hidden; /* When the ng-hide class is removed from the page elementThis is used to hide, the hidden pages that have the ng-hide class */
    position: relative;
}

/* 
    This is the default styling of a visible page.
    
    The "transition" property states, that whenever the value of the "transform" property changes,
    apply the new value linear, with a duration of 0.5s to transition from the orignal value to the 
    new value.

    The pages are stacked on top of each other, by using absolute positioning.
*/
animation .list .page {
    bottom: 0;
    left: 0;
    padding: 10px;
    position: absolute;
    right: 0;
    top: 0;
    -webkit-transition: transform 0.5s linear 0s;
    -moz-transition: transform 0.5s linear 0s;
    -o-transition: transform 0.5s linear 0s;
    transition: transform 0.5s linear 0s;
}

/*
    Move previous pages outside of the list (invisible for the user), on the top side of the list.
*/
animation .list .page.previous {
    transform: translateY(-100%);
}

/*
    Move next pages outside of the list (invisible for the user), on the bottom side of the list.
*/
animation .list .page.next {
    transform: translateY(100%);
}
            
          
!
            
              var poc;
(function (poc) {
    'use strict';
    angular.module('poc', ['ngAnimate']);

    
  
  
  
  function getRandomColor() {
        var letters = '0123456789ABCDEF';
        var color = '#';
        for (var i = 0; i < 6; i++) {
            color += letters[Math.floor(Math.random() * 16)];
        }
        return color;
    }
    var maxPages = 10;
    var AnimationDirective = (function () {
        function AnimationDirective() {
            this.restrict = 'E';
            this.template = "\n\n    <button type=\"button\" ng-click=\"setCurrentPageIndex(currentPageIndex - 1);\">Previous page</button>\n    <button type=\"button\" ng-click=\"setCurrentPageIndex(currentPageIndex + 1);\">Next page</button>\n    <div id=\"list\" class=\"list\">\n        <div \n            id=\"page-{{$index}}\" \n            class=\"page\"\n            ng-class=\"{ previous: $index < currentPageIndex, next: $index > currentPageIndex }\"\n            ng-repeat=\"page in pages\"\n            ng-style=\"page.style\">\n            {{page}}\n        </div>\n    </div>\n    \n    ";
            var self = this;
            self.link = self.unboundLink.bind(self);
        }
        AnimationDirective.prototype.unboundLink = function ($scope, $element, attrs) {
            var self = this;
            function isCurrentPageIndex(index) {
                return $scope.currentPageIndex === index;
            }
            function setCurrentPageIndex(index) {
                index = index < 0 ? 0 : index;
                index = index >= maxPages ? maxPages - 1 : index;
                $scope.currentPageIndex = index;
            }
            $scope.isCurrentPageIndex = isCurrentPageIndex;
            $scope.setCurrentPageIndex = setCurrentPageIndex;
            $scope.pages = [];
            for (var i = 0; i < maxPages; i++) {
                var color = getRandomColor();
                $scope.pages.push({
                    color: color,
                    name: "Page " + i.toString(),
                    style: { 'background-color': color }
                });
            }
            $scope.currentPageIndex = 0;
        };
        return AnimationDirective;
    }());
  angular.module('poc').directive('animation', [function () { return new AnimationDirective(); }]);
  
  
  
  
  angular.bootstrap(document, ['poc']);
})(poc || (poc = {}));



            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console