【发布时间】:2018-06-22 12:03:30
【问题描述】:
我当前的下拉列表很大。见下图。
如何解决这个问题?我正在考虑使用适当的 JS 重新定位菜单。 请帮忙。如何禁用自动定位?
这是我的代码示例
<div class="btn-group">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Action
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</div>
注意:当我滚动页面时,下拉菜单上会应用内联 css,并将 css 属性更改为屏幕滚动。我该如何解决这个问题?
element.style {
left: 0px;
position: absolute;
transform: translate3d(16px, -258px, 0px);
top: 0px;
will-change: transform;
}
提前致谢
【问题讨论】:
-
你在这里的目的是什么?有一个更短的下拉列表?
-
你的意思是,高度太大了?
-
正确的js根据屏幕大小改变内联样式。我想停止或禁用它。 element.style { 左:0px;位置:绝对;变换:translate3d(16px,-258px,0px);顶部:0px; will-change:变换; }
标签: jquery html css twitter-bootstrap bootstrap-4