首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在html中复制此效果的jquery手风琴

在html中复制此效果的jquery手风琴
EN

Stack Overflow用户
提问于 2014-06-16 11:04:40
回答 1查看 163关注 0票数 0

嗨,我需要做一个完整的高度手风琴从底部到顶部,类似于这个网站的http://www.chequerscapital.com/ (我也有一个脚下面的手风琴)。

内容是在页面加载时加载的,因此不涉及ajax,我尝试使用jQuery手风琴插件,但使用它时遇到了问题-第一个问题是使其100%高,其次是jquery隐藏父部分中的所有div。

这是我的问题的jsfiddle链接,任何信息都很感激,也许我需要重新考虑使用的工具或页面结构?这些代码仅适用于主要的新浏览器(来自IE 10)。

http://jsfiddle.net/4Cm4j/2/

代码语言:javascript
复制
<div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">
        <div class="accordion">
            <header> <a href="#">Leistungen</a>

            </header>
            <section>
                <article id="post-4" class="post-4 page type-page status-publish hentry">
                    <header class="entry-header">
                            <h1 class="entry-title">Leistungen</h1> 
                    </header>
                    <!-- .entry-header -->
                    <div class="entry-content"></div>
                    <!-- .entry-content -->
                    <footer class="entry-footer">   <span class="edit-link"><a class="post-edit-link" href="http://localhost/c4v/wp-admin/post.php?post=4&amp;action=edit">Edit</a></span>  
                    </footer>
                    <!-- .entry-footer -->
                </article>
                <!-- #post-## -->
            </section>
            <header> <a href="#">Team</a>

            </header>
            <section>test</section>
            <header> <a href="#">Track record</a>

            </header>
            <section>
                <article id="post-6" class="post-6 page type-page status-publish has-post-thumbnail hentry">
                    <header class="entry-header">
                            <h1 class="entry-title">Track record</h1>   
                    </header>
                    <!-- .entry-header -->
                    <div class="entry-content">
                        <img width="1200" height="230" src="trackrecord.jpg" class="attachment-full wp-post-image" alt="trackrecord">
                    </div>
                    <!-- .entry-content -->
                    <footer class="entry-footer">   <span class="edit-link"><a class="post-edit-link" href="http://localhost/c4v/wp-admin/post.php?post=6&amp;action=edit">Edit</a></span>  
                    </footer>
                    <!-- .entry-footer -->
                </article>
                <!-- #post-## -->
            </section>
            <header> <a href="http://localhost/c4v/?page_id=13">Kontakt</a>

            </header>
            <section>
                <article id="post-13" class="post-13 page type-page status-publish hentry">
                    <header class="entry-header">
                            <h1 class="entry-title">Kontakt</h1>    
                    </header>
                    <!-- .entry-header -->
                    <div class="entry-content"></div>
                    <!-- .entry-content -->
                    <footer class="entry-footer">   <span class="edit-link"><a class="post-edit-link" href="http://localhost/c4v/wp-admin/post.php?post=13&amp;action=edit">Edit</a></span> 
                    </footer>
                    <!-- .entry-footer -->
                </article>
                <!-- #post-## -->
            </section>
        </div>
    </main>
    <!-- #main -->
</div>
代码语言:javascript
复制
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
.accordion {
    z-index: 100;
    position: fixed;
    bottom: 3em;
    width: 100%;
    left: 0;
}
.accordion header {
    background-color: #ccc;
    border-top: 2px solid #fff;
    margin: 0;
    padding: 0;
    padding: .4em 0;
}
.accordion header a {
    display: block;
    text-transform: uppercase;
    font-size: 1em;
    color: #fff;
    text-decoration: none;
    font-family:'Arial';
}
.accordion>section {
    margin:0 auto;
    width:1000px
}
代码语言:javascript
复制
$(function () {
    $(".accordion").accordion({
        header: "header",
        collapsible: true,
        icons: false,
        active: false,
        fillSpace: true
    });
});
EN

回答 1

Stack Overflow用户

发布于 2014-06-16 16:00:26

在没有任何插件的情况下检查jsFiddle上的演示

无插件的jsFiddle Accordian

代码语言:javascript
复制
$(".accordian-heading").click(function () {
    $(".accordian-content").slideUp();
    $(this).next(".accordian-content").slideToggle();
})
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24242245

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档