bootstrap 手风琴和旋转木马显示和隐藏在活动中

问题描述

我有一个轮播,它连接到一个带有 ACF 转发器的 wordpress 站点,供用户创建一系列标题、文本和图像。当滑块按照顺序移动时,它会显示相关的标题和图像。

我的问题

我现在试图让手风琴折叠或显示取决于类是否处于活动状态,如您所见,我已尝试在 aria-expanded="<?PHP echo ($count) >= 1 ? '' : 'true'; ?>" 下的按钮中使用我的 PHP 进行设置,但是它会起作用当我运行该站点时,它似乎不起作用,甚至更改为 true。

有人知道我做错了什么或如何解决这个问题吗?

谢谢

代码

      <?PHP
$repeater = get_field('section_8_slider');
$count = 0;
$section = "section_8_";
?>
<section class="pb-5">
    <div class="container">
        <div id="carousel_03" class="carousel slide" data-ride="carousel">
            <div class="row">
                <div class="col">
                    <div class="carousel-indicators tabs row">
                        <?PHP if (have_rows($section . 'slider')):
                            while (have_rows($section . 'slider')):
                                the_row(); ?>
                                <div id="accordion" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
                                    <div class="card">
                                        <div data-target="#carousel_03" data-slide-to="<?PHP echo($count++); ?>" role="button" id="headingOne"
                                             class="carousel-indicator p-3">
                                            <h4 data-toggle="collapse" data-target="#collapSEOne<?PHP echo($count++); ?>"
                                                aria-expanded="<?PHP echo ($count) >= 1 ? '' : 'true'; ?>"
                                                aria-controls="collapSEOne"><?PHP the_sub_field('title',$post->ID) ?>
                                            </h4>
                                        </div>
                                        <div id="collapSEOne<?PHP echo($count++); ?>" class="collapse aria-expanded= <?PHP echo ($count) >= 1 ? '' : 'show'; ?>"
                                             aria-labelledby="headingOne" data-parent="#accordion">
                                            <div class="card-body">
                                                <p class="small m-0">
                                                    text here <?PHP the_sub_field('text',$post->ID) ?>
                                                </p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <?PHP endwhile;
                        endif; ?>
                    </div>
                </div>
                <div class="col">
                    <div class="carousel-inner">
                        <?PHP foreach ($repeater as $rowNumber => $row): ?>
                            <div class="carousel-item<?PHP if ($rowNumber === 0) : ?> active<?PHP endif ?>">
                                <img class="img-fluid w-100" src="<?= $row['image']['url'] ?>" alt="<?= $row['image']['alt'] ?>">
                            </div>
                        <?PHP endforeach ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

解决方法

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

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

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