From 794409f4e29ac506ad25e96b66ccc32e3b849fa4 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Thu, 7 Jun 2012 14:43:14 -0700 Subject: [PATCH] tweak chrome example to ignore initial transition animation --- examples/chrome/index.html | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/examples/chrome/index.html b/examples/chrome/index.html index 88dc7710..45846014 100644 --- a/examples/chrome/index.html +++ b/examples/chrome/index.html @@ -54,29 +54,37 @@

Not Found

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() {