Skip to content

Commit

Permalink
tweak chrome example to ignore initial transition animation
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jun 7, 2012
1 parent 074cafc commit 794409f
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions examples/chrome/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,37 @@ <h2>Not Found</h2>
next();
}

function showHistory() {
render(template('history'));
function showHistory(ctx) {
// !ctx.init tells render() not to
// add the .hide class so that the
// transition animation is ignored
// for the initial page
render(template('history'), !ctx.init);
}

function showExtensions() {
render(template('extensions'));
function showExtensions(ctx) {
render(template('extensions'), !ctx.init);
}

function showSettings() {
render(template('settings'));
function showSettings(ctx) {
render(template('settings'), !ctx.init);
}

function notfound() {
render(template('not-found'));
function notfound(ctx) {
render(template('not-found'), !ctx.init);
}

function render(html) {
function render(html, hide) {
var el = document.getElementById('content');
el.classList.add('hide');
setTimeout(function(){
if (hide) {
el.classList.add('hide');
setTimeout(function(){
el.innerHTML = html;
el.classList.remove('hide');
}, 300);
} else {
el.innerHTML = html;
el.classList.remove('hide');
}, 300);
}
}

function deactiveate() {
Expand Down

0 comments on commit 794409f

Please sign in to comment.