Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.




                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 {
    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=\"\">\n            {{page}}\n        </div>\n    </div>\n    \n    ";
            var self = this;
   = 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();
                    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 = {}));