From ed287731785c90a00c4dd91ba21d904e3b8f2e01 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 28 Dec 2011 16:10:03 +0000 Subject: [PATCH] Added scrollTo animation for navigation in TW5 --- js/StoryNavigator.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/StoryNavigator.js b/js/StoryNavigator.js index 57c737316..917559128 100644 --- a/js/StoryNavigator.js +++ b/js/StoryNavigator.js @@ -16,7 +16,11 @@ var StoryNavigator = function(navigators) { StoryNavigator.prototype.navigateTo = function(title) { var tiddlerHtml = this.navigators.store.renderTiddler("text/html","SimpleTemplate",title); if(tiddlerHtml) { - $("
").html(tiddlerHtml).appendTo("body"); + var article = $("
").html(tiddlerHtml); + article.appendTo("body"); + $("html,body").animate({ + scrollTop: article.offset().top + }, 400); return false; } else { return true;