gpt4 book ai didi

javascript - 嵌套 Accordion - 在 Accordion 内添加 anchor 链接和 Accordion

转载 作者:行者123 更新时间:2023-11-30 20:51:30 32 4
gpt4 key购买 nike

尝试创建嵌套 Accordion 时,是否可以使用 jquery 在另一个 Accordion 内部创建 anchor 链接和 Accordion ?

例如,在我的代码中我有 <div>用于 Accordion 内容和<h3>用于 Accordion 标题。

代码是 https://jsfiddle.net/vsf8kwko/6/

   <div id="outer-accordion">
<h3>Outer Section </h3>
<!-- I need to add anchor link under here and not an accordion. Is this possible -->
<!--<div><li><a href="www.google.com">LINK</a></li></div>-->


<!-- inner accordian -->
<div id="inner-accordion" >

<h3>Inner Section </h3> //Accordion header
<div> //Accordion content
<p>Inner Mauris <a href="www.google.com">LINK</a>.</p>
</div>


</div>
<!-- inner accordian -->


</div>

最佳答案

您需要将linkinner-accordion 都放在li 标签内。我已经更新了你的 fiddle .现在检查一下

<div id="outer-accordion">
<h3>Outer Section </h3>
<!-- I need to add anchor link here and not an accordion. Is this possible -->
<ul>
<li><a href="www.google.com">LINK</a></li>
<li>
<!-- inner accordian -->
<div id="inner-accordion" >

<h3>Inner Section </h3>
<div>
<p>Inner Mauris <a href="www.google.com">LINK</a>.</p>
</div>

</div>
<!-- inner accordian -->
</li>
</ul>
</div>

关于javascript - 嵌套 Accordion - 在 Accordion 内添加 anchor 链接和 Accordion ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48127658/

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