File tree Expand file tree Collapse file tree 4 files changed +31
-10
lines changed Expand file tree Collapse file tree 4 files changed +31
-10
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,13 @@ const Dropdown = (($) => {
64
64
VISIBLE_ITEMS : '.dropdown-menu .dropdown-item:not(.disabled)'
65
65
}
66
66
67
+ const AttachmentMap = {
68
+ TOP : 'top' ,
69
+ BOTTOM : 'bottom'
70
+ }
71
+
67
72
const Default = {
68
- placement : 'bottom' ,
73
+ placement : AttachmentMap . BOTTOM ,
69
74
offset : 0
70
75
}
71
76
@@ -141,8 +146,10 @@ const Dropdown = (($) => {
141
146
return false
142
147
}
143
148
149
+ // Handle dropup
150
+ const dropdownPlacement = $ ( this ) . parent ( ) . hasClass ( 'dropup' ) ? AttachmentMap . TOP : context . _config . placement
144
151
this . _popper = new Popper ( this , context . _menu , {
145
- placement : context . _config . placement ,
152
+ placement : dropdownPlacement ,
146
153
modifiers : {
147
154
offset : {
148
155
offset : context . _config . offset
Original file line number Diff line number Diff line change @@ -456,7 +456,7 @@ $(function () {
456
456
assert . expect ( 1 )
457
457
var done = assert . async ( )
458
458
459
- var containerHTML = '<div>'
459
+ var containerHTML = '<div id="test" >'
460
460
+ '<p style="margin-top: 200px">'
461
461
+ '<a href="#" title="very very very very very very very long tooltip">Hover me</a>'
462
462
+ '</p>'
@@ -482,7 +482,12 @@ $(function () {
482
482
} )
483
483
. on ( 'shown.bs.tooltip' , function ( ) {
484
484
var $tooltip = $ ( $ ( this ) . data ( 'bs.tooltip' ) . tip )
485
- assert . ok ( Math . round ( $tooltip . offset ( ) . top + $tooltip . outerHeight ( ) ) >= Math . round ( $ ( this ) . offset ( ) . top ) )
485
+ if ( / i P h o n e | i P a d | i P o d / . test ( navigator . userAgent ) ) {
486
+ assert . ok ( Math . round ( $tooltip . offset ( ) . top + $tooltip . outerHeight ( ) ) <= Math . round ( $ ( this ) . offset ( ) . top ) )
487
+ }
488
+ else {
489
+ assert . ok ( Math . round ( $tooltip . offset ( ) . top + $tooltip . outerHeight ( ) ) >= Math . round ( $ ( this ) . offset ( ) . top ) )
490
+ }
486
491
done ( )
487
492
} )
488
493
. bootstrapTooltip ( 'show' )
Original file line number Diff line number Diff line change @@ -58,6 +58,19 @@ <h1>Dropdown <small>Bootstrap Visual Test</small></h1>
58
58
</ div >
59
59
</ li >
60
60
</ ul >
61
+
62
+ <!-- Default dropup button -->
63
+ < div class ="btn-group dropup " style ="margin-top: 60px; ">
64
+ < button type ="button " class ="btn btn-secondary "> Dropup</ button >
65
+ < button type ="button " class ="btn btn-secondary dropdown-toggle " data-toggle ="dropdown " aria-haspopup ="true " aria-expanded ="false ">
66
+ < span class ="sr-only "> Toggle Dropdown</ span >
67
+ </ button >
68
+ < div class ="dropdown-menu ">
69
+ < a class ="dropdown-item " href ="# "> Action</ a >
70
+ < a class ="dropdown-item " href ="# "> Another action</ a >
71
+ < a class ="dropdown-item " href ="# "> Something else here</ a >
72
+ </ div >
73
+ </ div >
61
74
</ div >
62
75
63
76
< script src ="../../../docs/assets/js/vendor/jquery-slim.min.js "> </ script >
Original file line number Diff line number Diff line change 23
23
}
24
24
}
25
25
26
+ // Allow for dropdowns to go bottom up (aka, dropup-menu)
27
+ // Just add .dropup after the standard .dropdown class and you're set.
26
28
.dropup {
27
29
.dropdown-toggle {
28
30
& ::after {
133
135
color : $dropdown-header-color ;
134
136
white-space : nowrap ; // as with > li > a
135
137
}
136
-
137
- // Allow for dropdowns to go bottom up (aka, dropup-menu)
138
- //
139
- // Just add .dropup after the standard .dropdown class and you're set.
140
-
141
- // .dropup {}
You can’t perform that action at this time.
0 commit comments