Skip to content

Instantly share code, notes, and snippets.

@chardane
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chardane/5c4d669363adf78ab3d2 to your computer and use it in GitHub Desktop.
Save chardane/5c4d669363adf78ab3d2 to your computer and use it in GitHub Desktop.
simple-view-more
<ul class="gallery">
<li>one</li>
<li>two</li>
</ul>
<ul class="gallery">
<li>three</li>
<li>four</li>
</ul>
<ul class="gallery">
<li>five</li>
<li>six</li>
</ul>
<button>View More</button>
$(document).ready(function() {
var gallery= $('.gallery');
gallery.addClass('hidden');
gallery.first().removeClass('hidden');
//look for all the hidden items, and show the first one
$(document).on('click', 'button', function(){
$('.gallery.hidden').first().slideDown().removeClass('hidden');
});
});
.hidden {
display: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment