我对表格中的下拉按钮有一个问题,当它们响应并滚动激活时,下拉按钮不可见,因为overflow: auto;属性.我该如何解决这个问题,以便在按钮折叠时显示按钮的下拉选项?我可以使用一些jQuery,但在我遇到左右滚动的问题后,我决定寻找另一种解决方案.

100

推荐答案

I solved myself this and I put the answer in scope to help other user that have same problem: We have an event in bootstrap and we can use that event to set overflow: inherit but this will work if you don't have the css property on your parent container.

$('.table-responsive').on('show.bs.dropdown', function () {
     $('.table-responsive').css( "overflow", "inherit" );
});

$('.table-responsive').on('hide.bs.dropdown', function () {
     $('.table-responsive').css( "overflow", "auto" );
})

and this is the fiddle

info: In this fiddle example works strange and I'm not sure why but in my project works just fine.

Jquery相关问答推荐

使用jquery ui来回滑动切换

我在自定义 WordPress 插件中使用 ajax 时收到错误请求

加载外部 css 文件,如 jquery 中的脚本,这在 ie 中也兼容

jquery数据表隐藏列

如何滚动到jQuery中的元素?

使用 JSONP 时如何捕获 jQuery $.getJSON(或数据类型设置为jsonp的 $.ajax)错误?

jquery清除输入默认值

调用 jquery ajax - .fail vs. :error

当有多个具有相同 ID 值的元素时,jQuery 是如何工作的?

如何使用 JQuery 发布 JSON 数据?

使用 D3.js(IE、safari 和 chrome)创建 SVG 后,如何保存/导出 SVG 文件?

jquery beforeunload 关闭(不离开)页面时?

jQuery.extend 和 jQuery.fn.extend 的区别?

从附加元素获取 jQuery 对象的更简单方法

使用 JQuery 获取触发事件的元素的类

触发下拉更改事件

如何使用 jQuery 格式化电话号码

通过单击按钮获取表格行的内容

jquery $(window).height() 正在返回文档高度

如何在 jQuery 中取消绑定悬停?