diff --git a/styles/bootstrap/bootstrap/js/bootstrap-typeahead.js b/styles/bootstrap/bootstrap/js/bootstrap-typeahead.js index 74db0d108..aeb772a98 100644 --- a/styles/bootstrap/bootstrap/js/bootstrap-typeahead.js +++ b/styles/bootstrap/bootstrap/js/bootstrap-typeahead.js @@ -157,10 +157,13 @@ , next = active.next() if (!next.length) { - next = $(this.$menu.find('li')[0]) + next = $(this.$menu.find(this.options.itemtag)[0]) } next.addClass('active') + var index = this.$menu.children().index(next) + var r = this.$menu.height()/next.height()-1; + this.$menu.scrollTop(this.$menu.scrollTop()+next.offset().top-50-index*r) } , prev: function (event) { @@ -168,10 +171,13 @@ , prev = active.prev() if (!prev.length) { - prev = this.$menu.find('li').last() + prev = this.$menu.find(this.options.itemtag).last() } prev.addClass('active') + var index = this.$menu.children().index(prev) + var r = this.$menu.height()/prev.height()-1; + this.$menu.scrollTop(this.$menu.scrollTop()+prev.offset().top-50-index*r) } , listen: function () { diff --git a/views/bootstrap/styles/application.js b/views/bootstrap/styles/application.js index 33679bded..a0804774a 100644 --- a/views/bootstrap/styles/application.js +++ b/views/bootstrap/styles/application.js @@ -90,6 +90,7 @@ function initMost() { * for each hit and render could only process strings. * */ $("#searchfield").typeahead({ /* {{{ */ + menu: '', minLength: 3, items: 100, /* the query will limit the number of hits */ source: function(query, process) { diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index 09e7b9c55..a4c205e86 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -93,7 +93,7 @@ function initMost() { * for each hit and render could only process strings. * */ $("#searchfield").typeahead({ /* {{{ */ - menu: '', + menu: '', item: '', itemtag: 'a', minLength: 3,