Bootstrap 5, 想在屏幕尺寸大于 900 的时候展开(aria-expanded="true"
, class="collapse show"
),屏幕尺寸小于 900 的时候收起(aria-expanded="false"
, class="collapse"
)。
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#ecommerce-collapse" aria-expanded="true">
myButton
</button>
<div class="collapse show" id="demo-collapse">
Something here
</div>
1
sudoy OP 最后用 js 解决了,window.addEventListener('resize', () => {});
|