]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
update docsearch config to handle h1s properly (load top of page, not at the h1)
authorMark Otto <markdotto@gmail.com>
Sat, 8 Jul 2017 20:02:13 +0000 (13:02 -0700)
committerMark Otto <markdotto@gmail.com>
Sat, 8 Jul 2017 20:02:13 +0000 (13:02 -0700)
_includes/scripts.html

index bc411c2265fe81b8fd7a6eccaf88bfc3153e51b2..da73fdd68aa06f90a80fffd72611117433363a45 100644 (file)
     apiKey: '48cb48b22351bc71ea5f12f4d1ede198',
     indexName: 'bootstrap-v4',
     inputSelector: '#search-input',
+    handleSelected: function (input, event, suggestion) {
+      var url = suggestion.url;
+      url = suggestion.isLvl1 ? url.split('#')[0]: url;
+      // If it's a title we remove the anchor so it does not jump.
+      window.location.href = url;
+    },
     transformData: function (hits) {
       return hits.map(function (hit) {
         hit.url = hit.url.replace('https://v4-alpha.getbootstrap.com', '/docs/4.0');