I had this problem too.
(我也有这个问题。)
Pretty much every fix I found would break something else.(我发现的每个修复程序几乎都会破坏其他功能。)
In the end, I ended up making it a dropup button.(最后,我最终将其设置为一个下拉按钮。)
It was working great until the dropdown list became too large, then it was hiding again so I just put a javascript function to change the top margin everytime the button is pressed (so that you can see everything again).(直到下拉列表变得太大为止,它一直很好用,然后再次隐藏了,因此,我只需要在每次按下按钮时都使用javascript函数更改顶部边距(这样您才能再次看到所有内容)。)
I had an action button for each row in my table so I had to add another statement that only changes the margin when the top button is pressed.
(我表中的每一行都有一个操作按钮,因此我不得不添加另一条语句,该语句仅在按下顶部按钮时才更改边距。)
I am not sure if you plan on having multiple action buttons but here is my fix for your initial issue:(我不确定您是否打算设置多个操作按钮,但这是我为您解决的第一个问题:)
https://jsfiddle.net/vndyLy1e/7/
(https://jsfiddle.net/vndyLy1e/7/)
$(document).on('show.bs.dropdown', function(e) {
if ($(e.relatedTarget).hasClass('queryDropdown')) {
$('#test').css('padding-top', '90px');
}
});
$(document).on('hide.bs.dropdown',function (e) {
if ($(e.relatedTarget).hasClass('queryDropdown')) {
$('#test').css('padding-top', '25px');
}
});
If you have multiple action dropdowns, just make sure only the top action dropdown has the id "queryDropdown" class.
(如果您有多个操作下拉菜单,只需确保仅顶部操作下拉菜单具有id“ queryDropdown”类。)
After that, all the rows below it will have their dropdowns drop up over the other elements in the table so it will look normal.(在那之后,它下面的所有行的下拉菜单将拖放到表中的其他元素上,因此它将看起来很正常。)
You can probably add a css animation to make the margin change more smooth.
(您可能可以添加css动画以使边距更改更加平滑。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…