Skip to content

Instantly share code, notes, and snippets.

@gslin
Created May 30, 2023 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gslin/1b86866f76c127219b9060101428c6c3 to your computer and use it in GitHub Desktop.
Save gslin/1b86866f76c127219b9060101428c6c3 to your computer and use it in GitHub Desktop.
function _enable( $container, prefix, page, isClosed ) {
...
// Restricted to links created by editors and thus outside our control
// T166544 - don't do this for reference links - they will be handled elsewhere
var $link = $container.find("a:not(.reference a)");
$link.on("click", function () {
// the link might be an internal link with a hash.
// if it is check if we need to reveal any sections.
if (
$link.attr("href") !== undefined &&
$link.attr("href").indexOf("#") > -1
) {
checkHash();
}
});
util.getWindow().on("hashchange", function () {
checkHash();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment