Skip to content

Commit 1747caf

Browse files
committed
insert menu of typeahead after input which it suggests on twbs#3529
note: this will likely break things for people in the same way that doing this to tooltip did… however we think this is a better insertion model for z-index,scrolling,modal,etc. applications
1 parent 4376540 commit 1747caf

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

docs/assets/js/bootstrap-typeahead.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
this.sorter = this.options.sorter || this.sorter
3434
this.highlighter = this.options.highlighter || this.highlighter
3535
this.updater = this.options.updater || this.updater
36-
this.$menu = $(this.options.menu).appendTo('body')
36+
this.$menu = $(this.options.menu).insertAfter(this.$element)
3737
this.source = this.options.source
3838
this.shown = false
3939
this.listen()
@@ -56,7 +56,7 @@
5656
}
5757

5858
, show: function () {
59-
var pos = $.extend({}, this.$element.offset(), {
59+
var pos = $.extend({}, this.$element.position(), {
6060
height: this.$element[0].offsetHeight
6161
})
6262

docs/assets/js/bootstrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,7 +1752,7 @@
17521752
this.sorter = this.options.sorter || this.sorter
17531753
this.highlighter = this.options.highlighter || this.highlighter
17541754
this.updater = this.options.updater || this.updater
1755-
this.$menu = $(this.options.menu).appendTo('body')
1755+
this.$menu = $(this.options.menu).insertAfter(this.$element)
17561756
this.source = this.options.source
17571757
this.shown = false
17581758
this.listen()
@@ -1775,7 +1775,7 @@
17751775
}
17761776

17771777
, show: function () {
1778-
var pos = $.extend({}, this.$element.offset(), {
1778+
var pos = $.extend({}, this.$element.position(), {
17791779
height: this.$element[0].offsetHeight
17801780
})
17811781

0 commit comments

Comments
 (0)