Have 8 rows showing with a button to load 8 more.
Trying to adjust button so when it reaches the end of showing all expandable divs (8 at a time), "Load More" button would change to "Load Less" and collapse upwards 8 at a time until it reaches its original load of just 8 boxes.
codepen with HTML/CSS/Javascript is here.
If possible, is there a way to adjust the JS so that:
The button adjusts from "load more" to "load less" instead of showing "No Content" which it does now?
The current JS can be found on the Codepen but also here:
$(document).ready(function(){
$(".content").slice(0, 8).show();
$("#loadMore").on("click", function(e){
e.preventDefault();
$(".content:hidden").slice(0, 8).slideDown();
if($(".content:hidden").length == 0) {
$("#loadMore").text("No Content").addClass("noContent");
}
});
})
Thanks!