summaryrefslogtreecommitdiffstats
path: root/doc/global/template/scripts/extras.js
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@digia.com>2014-10-21 14:57:50 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2014-12-03 12:20:07 +0100
commit457496b83090006b232c56c04042bf6c9b8b2c31 (patch)
tree36e1e6c24b20b4a374f9cee081da7746553fa2f1 /doc/global/template/scripts/extras.js
parent1ed09b486eaca10c11aa454d648ad857f819b183 (diff)
Doc: new template for qt.io online style
An online documentation template that follows the style of qt.io site. Update the url variable for Qt modules to point to doc.qt.io/qt-5/. Task-number: QTBUG-42086 Change-Id: I5428a02cd503aef2217efd7361f4c8b7b5895a52 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Diffstat (limited to 'doc/global/template/scripts/extras.js')
-rw-r--r--doc/global/template/scripts/extras.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/global/template/scripts/extras.js b/doc/global/template/scripts/extras.js
new file mode 100644
index 0000000000..cb1102d493
--- /dev/null
+++ b/doc/global/template/scripts/extras.js
@@ -0,0 +1,23 @@
+var vOffset = 65;
+
+$(function () {
+ $('a[href*=#]:not([href=#])').on('click', function () {
+ var target = $(this.hash);
+ target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
+ if (target.length) {
+ setTimeout(function () {
+ $('html, body').animate({scrollTop: target.offset().top - vOffset}, 50);}, 50);
+ // return false;
+ }
+ });
+});
+
+$(window).load(function () {
+ var h = window.location.hash;
+ var re = /[^a-z0-9_\#\-]/i
+ if (h.length > 1 && !re.test(h)) {
+ setTimeout(function () {
+ $(window).scrollTop($(h).offset().top - vOffset);
+ }, 0);
+ }
+});