summaryrefslogtreecommitdiffstats
path: root/doc/global
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2017-07-21 09:57:00 +0200
committerEike Ziller <eike.ziller@qt.io>2017-08-29 11:25:27 +0000
commit3b962d16dba91aa13ad6bc04abc7608b6de5bdf4 (patch)
tree3c399b957e7e25766d284e4a09b1021724ebdb20 /doc/global
parent041df6e2aedcf0d8a305a503045965cc15cec2a2 (diff)
Fix jumping to anchors with offline style
If the style changes after the browser already jumped to an anchor, the resulting browser position will be messed up. So, after we changed the style we need to make sure that we jump to the anchor again. Since browsers do not jump to anchors that they already jumped to, that means first jumping to the top, then to the actual anchor. Task-number: QTCREATORBUG-18448 Change-Id: I86c736adab6940903276f8a896b4054ddae11ebe Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'doc/global')
-rw-r--r--doc/global/qt-html-templates-offline-simple.qdocconf10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/global/qt-html-templates-offline-simple.qdocconf b/doc/global/qt-html-templates-offline-simple.qdocconf
index 1fea752a16..c3c2d3cca0 100644
--- a/doc/global/qt-html-templates-offline-simple.qdocconf
+++ b/doc/global/qt-html-templates-offline-simple.qdocconf
@@ -7,6 +7,16 @@ HTML.headerstyles = \
" <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline-simple.css\" />\n" \
" <script type=\"text/javascript\">\n" \
" document.getElementsByTagName(\"link\").item(0).setAttribute(\"href\", \"style/offline.css\");\n" \
+ " // loading style sheet breaks anchors that were jumped to before\n" \
+ " // so force jumping to anchor again\n" \
+ " setTimeout(function() {\n" \
+ " var anchor = location.hash;\n" \
+ " // need to jump to different anchor first (e.g. none)\n" \
+ " location.hash = \"#\";\n" \
+ " setTimeout(function() {\n" \
+ " location.hash = anchor;\n" \
+ " }, 0);\n" \
+ " }, 0);\n" \
" </script>\n"
HTML.postheader = \