summaryrefslogtreecommitdiffstats
path: root/tools/droiddoc/templates-sdk/assets/js
diff options
context:
space:
mode:
authorsmain@google.com <smain@google.com>2014-10-03 09:25:59 -0700
committerScott Main <smain@google.com>2014-10-03 18:34:20 +0000
commit9a818f55f4a4ca4f88c2a29f8e77ea6cb2153de6 (patch)
tree08eb5ee79bdfca65f48e2fbf617e50049b80e5b0 /tools/droiddoc/templates-sdk/assets/js
parent83fadade5bbc43914059405c1e49dd112e66d28d (diff)
downloadbuild-9a818f55f4a4ca4f88c2a29f8e77ea6cb2153de6.zip
build-9a818f55f4a4ca4f88c2a29f8e77ea6cb2153de6.tar.gz
build-9a818f55f4a4ca4f88c2a29f8e77ea6cb2153de6.tar.bz2
more fixes to scroll offset for the sticky header.
This offsets the layout position of all <a name=""> tags so they naturally show up below the sticky nav bar... though this is only for API reference, which uses <a> tags as anchors for all API members. bug: 16924057 Change-Id: I88c1e8192f1cbb5373af592b9e9f9a04ffe6fc7c
Diffstat (limited to 'tools/droiddoc/templates-sdk/assets/js')
-rw-r--r--tools/droiddoc/templates-sdk/assets/js/docs.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index f03fb88..5e548c8 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -2535,16 +2535,13 @@ google.setOnLoadCallback(function(){
}
}, true);
-/* Adjust the scroll position to account for sticky header, only if the hash matches an id */
+/* Adjust the scroll position to account for sticky header, only if the hash matches an id.
+ This does not handle <a name=""> tags. Some CSS fixes those, but only for reference docs. */
function offsetScrollForSticky() {
var hash = escape(location.hash.substr(1));
var $matchingElement = $("#"+hash);
- // If there's no element with the hash as an ID, then look for an <a name=''> with it.
- if ($matchingElement.length < 1) {
- $matchingElement = $('a[name="' + hash + '"]');
- }
- // Sanity check that there's an element with that ID on the page
- if ($matchingElement.length) {
+ // Sanity check that hash is a real hash and that there's an element with that ID on the page
+ if ((hash.indexOf("#") == 0) && $matchingElement.length) {
// If the position of the target element is near the top of the page (<20px, where we expect it
// to be because we need to move it down 60px to become in view), then move it down 60px
if (Math.abs($matchingElement.offset().top - $(window).scrollTop()) < 20) {