Last active
August 29, 2015 14:14
-
-
Save chardane/5c4d669363adf78ab3d2 to your computer and use it in GitHub Desktop.
simple-view-more
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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'); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hidden { | |
display: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment