简体   繁体   中英

replicating this effect in html with jquery accordion

Hi i need to make a full height accordion from bottom to top similar to this website http://www.chequerscapital.com/ (i also have a footer below the accordion).

The content is loaded as the page loads, so there's no ajax involved, I tried to use the jQuery accordion plugin but ran into problems using it - the first problem is making it 100% height, - second one is that jquery hides all divs inside the parent section

Here's the jsfiddle link for my problem, any information is appreciated maybe i need to rethink the tools used or the page structure? The code is needed only for the major new browsers (from IE 10)

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


<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>

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
}

$(function () {
    $(".accordion").accordion({
        header: "header",
        collapsible: true,
        icons: false,
        active: false,
        fillSpace: true
    });
});

Check this demo on jsFiddle without any plugin

jsFiddle Accordian without plugin

$(".accordian-heading").click(function () {
    $(".accordian-content").slideUp();
    $(this).next(".accordian-content").slideToggle();
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM