[third] Don't move typeahead popups when the body scrolls.

Trac #1479

All our typeaheads use this, but I made it an option that must be enabled
explicitly since it is not default bootstrap behavior.

(imported from commit 97852dc407d1f6dbe46b5fdd2c56d3ed8c6718d2)
This commit is contained in:
Kevin Mehall
2013-08-21 11:37:54 -04:00
parent 834ff7d750
commit f944a8ed0e
3 changed files with 20 additions and 1 deletions

View File

@@ -1826,6 +1826,11 @@
this.source = this.options.source
this.shown = false
this.dropup = this.options.dropup
this.fixed = this.options.fixed || false;
if (this.fixed) {
this.$menu.css('position', 'fixed');
}
// The naturalSearch option causes arrow keys to immediately
// update the search box with the underlying values from the
// search suggestions.
@@ -1854,7 +1859,16 @@
}
, show: function () {
var pos = $.extend({}, this.$element.offset(), {
var pos;
if (this.fixed) {
// Relative to screen instead of to page
pos = this.$element[0].getBoundingClientRect();
} else {
pos = this.$element.offset();
}
pos = $.extend({}, pos, {
height: this.$element[0].offsetHeight
})