I'm trying to make it where if you click on a button in the side bar it shows/slides up some text in the content section on the right of the sidebar. I would also like to toggle this by clicking the button (if that makes sense).
Any help would be really appreciated.
This is what I have so far: Fiddle: https://jsfiddle.net/fymjqonc/4/
$(function($) {
$('.show').click(function() {
$('.toggle').hide();
$('#' + $(this).data('toggle')).show();
});
$('[data-toggle="item1"]').click();
});
.container {
display: grid;
grid-template-columns: 1fr 2fr;
grid-gap: 20px;
}
.nav {
background: lightgrey;
color: #FFF;
}
.nav ul {
list-style: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<nav class="nav">
<ul>
<li><a href="#" class="show" data-toggle="item1">Item 1</a></li>
<li><a href="#" class="show" data-toggle="item2">Item 2</a></li>
<li><a href="#" class="show" data-toggle="item3">Item 3</a></li>
<li><a href="#" class="show" data-toggle="item4">Item 4</a></li>
<li><a href="#" class="show" data-toggle="item5">Item 5</a></li>
</ul>
</nav>
<div class="content">
<div class="toggle" id="item1">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni rerum repellat sed quo eum consequuntur aliquid nobis dolore tempore. Enim.</p>
</div>
<div class="toggle" id="item2">
<p>Step 2</p>
</div>
<div class="toggle" id="item3">
<p>Step 3</p>
</div>
<div class="toggle" id="item4">
<p>Step 4</p>
</div>
<div class="toggle" id="item5">
<p>Step 5</p>
</div>
</div>