同时打开所有手风琴窗口 [英] Open all accordion windows at the same time

查看:23
本文介绍了同时打开所有手风琴窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的应用程序使用 jQuery 手风琴插件.有没有办法同时打开部分(页面加载后),以便同时显示所有页面的内容.如果不可能,请给我一个链接,我可以在其中实现与该功能类似的功能.谢谢.我是 jQuery 的新手.

解决方案

jQuery 使您无需插件即可轻松制作自己的手风琴.例如,这个 HTML:

第一节

<div class="accordion_content">..... 内容在这里......

还有这个 jQuery:

$('.accordion_toggler').click(function() {$(this).next('.accordion_content').slideToggle();});

任何时候你点击一个 accordion_toggler ,下面的 accordion_content 就会切换(在这种情况下向上或向下滑动).要开始隐藏所有内容但允许同时打开多个内容,请使用此 CSS:

.accordion_content { 显示:无}

I am using jQuery accordion plugin for my application. Is there a way to open sections at the same time(after page has loaded) so that contents of all pages are shown at the same time. If it is not possible please give me a link where I can achieve similar to that functionality. Thanks. I am a newbie to jQuery.

解决方案

jQuery makes it very easy to make your own accordion without a plugin. For example, this HTML:

<div class="accordion_toggler">
    Section One
</div>

<div class="accordion_content">
    ..... content here ......
</div>

and this jQuery:

$('.accordion_toggler').click(function() {
    $(this).next('.accordion_content').slideToggle();
});

Any time you click on an accordion_toggler , the following accordion_content will toggle (slide up or down in this case). To start with all the content hidden but allow multiple to be open at the same time, use this CSS:

.accordion_content { display: none }

这篇关于同时打开所有手风琴窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆