Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ianthekirkland/7cabc7a913ef7e3e4de5d5feb69e90be to your computer and use it in GitHub Desktop.
Save ianthekirkland/7cabc7a913ef7e3e4de5d5feb69e90be to your computer and use it in GitHub Desktop.
Foundation/Responsive Accordion Tabs/Tabs (Flex)
<!-- This demo uses flex grid but you can use float grid too -->
<section class="container">
<div class="row">
<div class="columns">
<h2>Responsive Accordion Tabs</h2>
<p>Either the <a href="//foundation.zurb.com/sites/docs/accordion.html">Accordion Markup</a> or the <a href="//foundation.zurb.com/sites/docs/tabs.html">Tabs Markup</a> can be used to responsively switch between the two components at different breakpoints.</p>
</div>
</div>
<div class="row">
<div class="columns">
<h4>Tabs HTML Markup</h4>
<div class="secondary callout">
<p>Once you put it all together, here's what you get!<br>Scale your browser down to see the toggle happen.<br>I am <code>Tabs on small and large</code> and <code>Accordion on medium</code></p>
</div>
</div>
</div>
<div class="row">
<div class="columns">
<ul class="tabs" data-responsive-accordion-tabs="tabs medium-accordion large-tabs" id="example-tabs">
<li class="tabs-title is-active"><a href="#panel1" aria-selected="true">Tab 1</a></li>
<li class="tabs-title"><a href="#panel2">Tab 2</a></li>
<li class="tabs-title"><a href="#panel3">Tab 3</a></li>
<li class="tabs-title"><a href="#panel4">Tab 4</a></li>
<li class="tabs-title"><a href="#panel5">Tab 5</a></li>
<li class="tabs-title"><a href="#panel6">Tab 6</a></li>
</ul>
<div class="tabs-content" data-tabs-content="example-tabs">
<div class="tabs-panel is-active" id="panel1">
<p>one</p>
<p>Check me out! I'm a super cool Tab panel with text content!</p>
</div>
<div class="tabs-panel" id="panel2">
<p>two</p>
<img class="thumbnail" src="//foundation.zurb.com/sites/docs/assets/img/generic/rectangle-7.jpg">
</div>
<div class="tabs-panel" id="panel3">
<p>three</p>
<p>Check me out! I'm a super cool Tab panel with text content!</p>
</div>
<div class="tabs-panel" id="panel4">
<p>four</p>
<img class="thumbnail" src="//foundation.zurb.com/sites/docs/assets/img/generic/rectangle-2.jpg">
</div>
<div class="tabs-panel" id="panel5">
<p>five</p>
<p>Check me out! I'm a super cool Tab panel with text content!</p>
</div>
<div class="tabs-panel" id="panel6">
<p>six</p>
<img class="thumbnail" src="//foundation.zurb.com/sites/docs/assets/img/generic/rectangle-8.jpg">
</div>
</div>
</div>
</div>
</section>
$(document).foundation();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://codepen.io/ZURBFoundation/pen/jmYLwq"></script>
/**
* Demo Styles
*/
* {
color: #444444;
}
body {
padding: 2rem 1rem;
}
.container {
width: 80%;
margin: auto;
margin-top: 2em;
}
.row {
margin-bottom: 2em;
}
.row.small-up-12 {
margin-bottom: 0;
}
.column {
margin-bottom: .5em;
}
/* Hides Foundation Docs Callout */
[href*="https://foundation.zurb.com/sites.html"] {
visibility: hidden !important;
padding: 0px !important;
margin: 0px !important;
width: 0px !important;
height: 0px !important;
display: none !important;
}
<link href="https://codepen.io/ZURBFoundation/pen/jmYLwq" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment