2列手风琴

问题描述

我想编写一个2列的手风琴,但是我不想使用js或bootstrap。

手风琴中的元素数量未知。 元素的数量是否为奇数都没有关系,但是如果是这样,则最后一个元素可以显示在左列中。

我使用流体模板(),通过它可以实现html中的循环:

<div>
    <f:for each="{field.element}" as="element" iteration="iter">
        <div class="element">
            <span class="title">{acc.title}</span>
            <div class="text">
                <span>{acc.text}</span>
            </div>
        </div>
    </f:for>
</div>

css:

.element {
    border-bottom: 1px solid #B0B7BA;
    padding-bottom: 8px;
    width: 100%;
}
.title {
    width: 100%;
    padding-right: 24px;
    cursor: pointer;
}
.title:after {
    content: '';
    position: absolute;
    display: block;
    width: 24px;
    height: 24px;
    right: 0;
    top: 6px;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    transition: all 0.2s ease-in-out;
}
.text {
    height: 0;
    overflow: hidden;
    pointer-events: none;
}
.active .text {
    padding-top: 24px;
}
.active .title:after {
    -webkit-transform:rotate(180deg);
    transform:rotate(180deg);
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)