gpt4 book ai didi

javascript - 仅在 Mobile View Bootstrap 3 上折叠

转载 作者:行者123 更新时间:2023-11-28 15:16:51 24 4
gpt4 key购买 nike

在桌面 View 中,“ul .item-description”应该是可见的,但在移动 View 中它应该是折叠的。我做到了,但在我看来,这是一个糟糕的决定。我该如何改进呢?此外,箭头第一次不起作用。如何解决?我试图用 js 解决这个问题,但是当我刷新页面时,我看到箭头是如何抽动的。

对不起,我的英文很烂。

jsfiddle - http://jsfiddle.net/p6t3brob/13/

html

<div class="collapsed-item">
<div class="collapse-element-title visible-xs" data-toggle="collapse" data-target="#items">collapse-title

</div>

<ul class="item-description hidden-xs" id="items">
<li class="title">title-text</li>
<li>item-item-item......</li>
<li>item-item-item......</li>
<li>item-item-item......</li>
<li>item-item-item......</li>
</ul>
</div>

CSS

.collapsed-item {
display: block;
outline: 1px solid red;
margin-top: 20px;
padding: 10px;
}

.collapse-element-title {
display: block;
outline: 1px solid orange;
position: relative;
padding-top: 10px;
padding-bottom: 10px;
}


.collapse-element-title:after {
display: block;
position: absolute;
top: 15px;
right: 10px;
width: 10px;
height: 10px;
border: 2px solid red;
border-top: none;
border-left: none;
transform: rotate(225deg);
content: "";
}

.collapse-element-title.collapsed:after {
top: 10px;
transform: rotate(45deg);
}

ul li {
margin-bottom: 10px;
}

.collapse-element-title {
cursor: pointer;
}

.collapse-element-title {
margin-bottom: 20px;
}

@media(max-width: 767px) {
#items.in,
#items.collapsing {
display: block!important;
}
}
@media(min-width: 768px) {
#crownDesc.collapse {
display: block !important;
height: auto !important;
}
}

最佳答案

尝试这样做 http://jsfiddle.net/p6t3brob/15/

<div class="collapsed-item">
<div class="collapse-element-title visible-xs collapsed" data-toggle="collapse" data-target="#items">collapse-title

</div>

<ul class="item-description hidden-xs collapse" id="items">
<li class="title">title-text</li>
<li>item-item-item......</li>
<li>item-item-item......</li>
<li>item-item-item......</li>
<li>item-item-item......</li>
</ul>
</div>

关于javascript - 仅在 Mobile View Bootstrap 3 上折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46992976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com