From be825e07f72cada135d8fca0130bb2beccc0374c Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Fri, 17 Sep 2010 22:59:33 +0000 Subject: Scroll to the top when toggling sections on the NTP. BUG=56075 TEST=Open NTP. Make window small enough to scroll. Open a different section, then reopen the original section. Scroll should have returned to top. Review URL: http://codereview.chromium.org/3415016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59870 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/resources/new_new_tab.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js index 4d5eacb..8a2691d 100644 --- a/chrome/browser/resources/new_new_tab.js +++ b/chrome/browser/resources/new_new_tab.js @@ -683,6 +683,9 @@ function toggleSectionVisibilityAndAnimate(section) { if (!section) return; + // It looks better to return the scroll to the top when toggling sections. + document.body.scrollTop = 0; + // We set it back in webkitTransitionEnd. document.documentElement.setAttribute('enable-section-animations', 'true'); if (shownSections & Section[section]) { -- cgit v1.1