docs: hide the "back to top" link when there's no vertical scroll
also use local variables for DOM objects (in a slow effort to eventually
remove all non-essential global vars)
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.js b/tools/droiddoc/templates/assets/android-developer-docs.js
index fa24e99..1099e6e 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.js
+++ b/tools/droiddoc/templates/assets/android-developer-docs.js
@@ -220,10 +220,12 @@
/* Resize the height of the side-nav and doc-content divs,
* which creates the frame effect */
function resizeHeight() {
+ var docContent = $("#doc-content");
+
// Get the window height and always resize the doc-content and side-nav divs
var windowHeight = ($(window).height() - HEADER_HEIGHT);
- content.css({height:windowHeight + "px"});
- sidenav.css({height:windowHeight + "px"});
+ docContent.css({height:windowHeight + "px"});
+ $("#side-nav").css({height:windowHeight + "px"});
var href = location.href;
// If in the reference docs, also resize the "swapper", "classes-nav", and "nav-tree" divs
@@ -239,6 +241,13 @@
} else if (href.indexOf("/resources/") != -1) {
$("#devdoc-nav").css({height:sidenav.css("height")});
}
+
+ // Hide the "Go to top" link if there's no vertical scroll
+ if ( parseInt($("#jd-content").css("height")) <= parseInt(docContent.css("height")) ) {
+ $("a[href='#top']").css({'display':'none'});
+ } else {
+ $("a[href='#top']").css({'display':'inline'});
+ }
}
/* Resize the width of the "side-nav" and the left margin of the "doc-content" div,