Can anyone assist me with implementing a "show more" and "show less" feature for a specific div?
I have put together a DEMO on codepen.io
In the DEMO, there are 8 red-framed div elements. I am looking to display a "show more" link if the total number of divs exceeds 4, and when clicked, all divs should be visible on the same page. Can someone provide guidance on this issue?
<div class="container">
<div class="post_wrap">
<div class="pst">
Post 1
</div>
<div class="pst">
Post 2
</div>
<div class="pst">
Post 3
</div>
<div class="pst">
Post 4
</div>
<div class="pst">
Post 5
</div>
<div class="pst">
Post 6
</div>
<div class="pst">
Post 7
</div>
<div class="pst">
Post 8
</div>
<div class="test"><a href="">Show More</a></div>
</div>
<div class="post_wrap">
<div class="pst">
Post 1
</div>
<div class="pst">
Post 2
</div>
<div class="pst">
Post 3
</div>
<div class="pst">
Post 4
</div>
<div class="pst">
Post 5
</div>
<div class="pst">
Post 6
</div>
<div class="pst">
Post 7
</div>
<div class="pst">
Post 8
</div>
<div class="test"><a href="">Show More</a></div>
</div>
</div>