Code Monkey home page Code Monkey logo

gaia-navigator's Introduction

gaia-navigator

Gaia Navigator is a partial implementation of a specification proposal for CSS navigation transitions.

Limitations

  • Each page must include gaia-navigator.js. After the first navigation, each subsequent page will be wrapped in an iframe.
  • The first page must take care to remove event listeners that may continue to fire after navigation. Attaching to the navigationtransitionend event may aid in this.
  • For reverse animations to work correctly, CSS property animation-delay must always be specified together with animation-duration.
  • Direct manipulation of the history and location objects will have unexpected results, instead use the shim objects available via gnc_getHistory and gnc_getLocation.
  • The last declared navigation-transition-z-index will apply for the duration of all transitions.
  • navigation-transition-z-index will override the z-index of document.body children on the first loaded page.
  • The proposed CSSOM for this specification is not available using this shim.
  • Changing style properties on html, body or iframe during navigations on the first loaded page can have unexpected effects.

TODO

  • Support navigation-transition-start property
  • Support a preload spec

Examples

Simple slide between two pages:

[page-1.html]

<head>
  <style>
    body {
      margin: 0;
      height: 100%;
    }

    #bg {
      width: 100%;
      height: 100%;
      background-color: red;
    }

    @navigation-transition exit 0.25s {
      #bg {
        animation-name: slide-left;
        animation-duration: 0.25s;
      }
    }

    @keyframes slide-left {
      from {}
      to { transform: translateX(-100%); }
    }
  </style>
</head>
<body>
  <div id="bg" onclick="window.location='page-2.html'"></div>
</body>

[page-2.html]

<head>
  <link rel="transition-enter" duration="0.25s" href="page-2-enter.css" />
  <style>
    body {
      margin: 0;
      height: 100%;
    }

    #bg {
      width: 100%;
      height: 100%;
      background-color: green;
    }

    @navigation-transition enter 0.25s {
      #bg {
        animation-name: slide-from-left;
        animation-duration: 0.25s;
      }
    }

    @keyframes slide-from-left {
      from { transform: translateX(100%) }
    }
  </style>
</head>
<body>
  <div id="bg" onclick="history.back()"></div>
</body>

gaia-navigator's People

Contributors

cwiiis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.