jQuery 手风琴 展开全部 [英] jQuery accordion Expand All
查看:36
javascript
jquery
html
accordion
本文介绍了jQuery 手风琴 展开全部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几个这种格式的手风琴.
<h3 class="some-class">这里还有一些其他的 span 元素</h3></div>在我的页面中,我有一个链接,上面写着 Expand All,通过单击此链接,我希望能够展开我所有的手风琴.
函数 expandAll(count) {for (i = 0; i <= count; i++) {$(函数(){if ($("#accordion-" + i + " h3").attr("aria-selected") !== "true") {$("#accordion-" + i + " h3").click();}})}}
只有第一个手风琴在扩展.我试图在 for 循环中放一个 console.log()
来打印 i
的值,但它只打印 0
这意味着我的循环在第一次扩展后终止.我无法理解这种行为.
欢迎任何帮助.谢谢:)
解决方案 试试这个:
$(".ui-accordion-content").show();
它将打开所有的手风琴.
I have several accordions in this format.
<div id="accordion-0" class="jquery-accordion ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="some-class">Some other span elements here</h3></div>
In my page, I have a link that says Expand All, by clicking this link I want to be able to expand all my accordions.
<a href="javascript:expandAll(10);">
function expandAll(count) {
for (i = 0; i <= count; i++) {
$(function() {
if ($("#accordion-" + i + " h3").attr("aria-selected") !== "true") {
$("#accordion-" + i + " h3").click();
}
})
}
}
Only the first accordion is getting expanded. I tried to put a console.log()
in the for loop to print the value of i
, but it is printing only 0
which means my loop is getting terminated after the first expansion. I am unable to understand this behavior.
Any help is welcome. Thanks :)
解决方案 Try this:
$(".ui-accordion-content").show();
It will open all the accordion.
这篇关于jQuery 手风琴 展开全部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文
相关文章
- jQuery UI 手风琴展开/折叠全部;
- jQuery 手风琴展开所有 div;
- jQuery手风琴展开所有div;
- 展开/折叠全部带有嵌套的手风琴和非手风琴的商品:BOOTSTRAP;
- Bootstrap手风琴展开/折叠全部无法正常运行;
- 手风琴中的 jQuery UI 手风琴;
- jQuery UI手风琴中的手风琴;
- 手风琴手风琴;
- 手风琴 JQuery 搜索;
- 手风琴JQuery搜索;
- jquery 多级手风琴;
- jquery手风琴效果;
- jQuery手风琴/Xsl;
- jQuery手风琴焦点;
- 嵌套手风琴jQuery;
- 使用链接打开 jQuery 手风琴面板(手风琴之外);
- Bootstrap 3手风琴vs jQuery UI手风琴;
- jQuery UI(jQuery手风琴);
- 手风琴内的手风琴会使父手风琴崩溃;
- bootstrap.js手风琴折叠/展开;
- Bootstrap折叠手风琴 - 默认展开/折叠?;
- 从URL展开特殊手风琴;
- 折叠和展开标签jquery /简单的手风琴;
- 折叠和展开标签 jquery/简单的手风琴;
- 带有顶级手风琴内容的 Jquery UI 嵌套手风琴;
前端开发最新文章
- 为什么Chrome(在Electron内部)突然重定向到chrome-error:// chromewebdata?;
- 错误102(net :: ERR_CONNECTION_REFUSED):服务器拒绝连接;
- 如何解决'重定向已被CORS策略阻止:没有'Access-Control-Allow-Origin'标题'?;
- 如何处理“Uncaught(in promise)DOMException:play()失败,因为用户没有首先与文档交互。”在桌面上使用Chrome 66?;
- 警告:添加非被动事件侦听器到滚动阻塞'touchstart'事件;
- 如何在浏览器中播放.TS文件(视频/ MP2T媒体类型)?;
- 此请求已被阻止;内容必须通过HTTPS提供;
- 资源解释为样式表,但转换为MIME类型text / html(似乎与web服务器无关);
- 通过HTTPS加载页面但请求不安全的XMLHttpRequest端点;
- 拒绝从执行脚本'*',因为它的MIME类型(“应用/ JSON')不是可执行文件,并严格MIME类型检查被启用。;