godoc: enable visibility of element linked from URL hash

Expands the example when visiting a URL such as
http://golang.org/pkg/net/http/#example_Hijacker

Fixes #5212.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/8378043
This commit is contained in:
Kamil Kisiel 2013-04-05 08:04:02 +11:00 committed by Andrew Gerrand
parent b72325fde4
commit 13d6f8f7f3
1 changed files with 8 additions and 0 deletions

View File

@ -179,6 +179,13 @@ function fixFocus() {
}).resize();
}
function toggleHash() {
var hash = $(window.location.hash);
if (hash.is('.toggle')) {
hash.addClass('toggleVisible').removeClass('toggle');
}
}
$(document).ready(function() {
bindSearchEvents();
generateTOC();
@ -190,6 +197,7 @@ $(document).ready(function() {
bindToggleLinks(".indexLink", "");
setupDropdownPlayground();
fixFocus();
toggleHash();
});
})();