Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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.


Auto Save

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.


    <meta charset="UTF-8">
    <title>Page Animations</title>
    <meta name="viewport" content="width=device-width" />
    <!-- <link rel="stylesheet" href="css/page-anim.css" /> -->
    <section data-page="home" id="home" class="active">
        <h1>The Page Home</h1>
        <p>Some content on the home page.</p>
        <p><a href="#other" data-role="link">GO TO OTHER</a></p>
    <section data-page="other" id="other">
        <h1>The Page Other</h1>
        <p>Some content on the other page.</p>
        <p><a href="#home" data-role="link">GO TO HOME</a></p>
    <!-- <script src="js/page-anim.js"></script> -->


    margin: 0;
    box-sizing: border-box;
:root {
    font-size: calc(1vw + 1vh + .5vmin);
body {
    font: 1rem/1.6 sans-serif;
    min-height: 100vh;
    overflow: hidden;
    position:fixed; /* or absolute if the content exceeds the height of the page */
    width: 100%;
    min-height: 100vh;
    transform: translate3d(100%, 0, 0);
    opacity: 0;
    transition: transform 0.5s ease-in, opacity 0.5s ease-in; 
    left: 100%;
    transition: left 1.0s ease-in; 
    z-index: 10;
    background-color: hsl(90, 70%, 20%);
    color: hsl(90, 90%, 90%);
    background-color: hsl(270, 70%, 20%);
    color: hsl(270, 90%, 90%);
    transform: translate3d(0, 0, 0);
    opacity: 1;
    left: 0;
    z-index: 100;
    color: white;
section h1{
    padding: 1rem;
    text-align: center;
section p{
    padding: 1rem 2rem;


//iife version of basic animation and navigation (without History API)
var app = (function(){
    let pages = [];
    let links = [];
    document.addEventListener("DOMContentLoaded", function(){
        pages = document.querySelectorAll('[data-page]');
        links = document.querySelectorAll('[data-role="link"]');
        //pages[0].className = "active";  - already done in the HTML
        [], function(link){
            link.addEventListener("click", navigate)
    function navigate(ev){
        let id = ev.currentTarget.href.split("#")[1];
        [], function(page){
           if( ===id){
        return false;
    return {
        xhr: ajax

//the navigate method is private inside our iife
//the variables pages and links are public and can be accessed as app.pages or app.links