Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved the propagation of URL fragment identifiers between versions.

The commit introduced in da11430
only worked if the user didn't navigate to another fragment
after the page had loaded.

With this new approach, the fragment is added to the version
swticher at the last moment which ensures it is up-to-date.
  • Loading branch information...
commit 365bb1f8d6a8f025291bf72fc9d2fea03761557e 1 parent da11430
@bmispelon bmispelon authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 docs/templates/docs/doc.html
View
12 docs/templates/docs/doc.html
@@ -8,12 +8,14 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
// Propagate the fragment identifier to the links in the version switcher
- if (window.location.hash) {
- $('#doc-versions a').each(function () {
- var anchor = $(this);
- anchor.attr('href', anchor.attr('href') + window.location.hash);
+ $(document).ready(function () {
+ // Propagate the fragment identifier to the links in the version switcher
+ $('#doc-versions a').click(function () {
+ var hrefWithoutFragment = this.href.split('#')[0];
+ this.href = hrefWithoutFragment + window.location.hash;
+ // do nothing and let the event bubble up
});
- }
+ });
</script>
{% if version == 'dev' %}
<div id="dev-warning">
Please sign in to comment.
Something went wrong with that request. Please try again.