From 11fc009469059aeafad1fea37fd4a3eb1a47dec9 Mon Sep 17 00:00:00 2001 From: "smain@google.com" Date: Thu, 16 Oct 2014 22:10:00 -0700 Subject: fix scroll offset when loading non-header pages Change-Id: I7a90ccf760eb06c291e88a3ace04c8c7498f75c1 --- tools/droiddoc/templates-sdk/assets/js/docs.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools') diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js index 3d278c3..a556f4f 100644 --- a/tools/droiddoc/templates-sdk/assets/js/docs.js +++ b/tools/droiddoc/templates-sdk/assets/js/docs.js @@ -2538,6 +2538,9 @@ google.setOnLoadCallback(function(){ /* Adjust the scroll position to account for sticky header, only if the hash matches an id. This does not handle tags. Some CSS fixes those, but only for reference docs. */ function offsetScrollForSticky() { + // Ignore if there's no search bar (some special pages have no header) + if ($("#search-container").length < 1) return; + var hash = escape(location.hash.substr(1)); var $matchingElement = $("#"+hash); // Sanity check that there's an element with that ID on the page -- cgit v1.1