Next Button Issue
Next button won't disappear
HTML
<div id="areaall">
<div class="review">
<div style="margin-bottom: 20px;" itemscope itemtype="http://schema.org/Review">
<div itemprop="itemReviewed" itemref="_name1" itemscope itemtype="http://schema.org/MedicalClinic">
</div>
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="worstRating" content="1" />
<span itemprop="ratingValue">5</span>/<span itemprop="bestRating">5</span> stars
</div>
<div>
<b>"<span itemprop="name">Travel Immunizations</span>"</b><br />
<span itemprop="reviewBody">"We were taken on time, everything was explained thoroughly,
a decision was made and the shots were given. An appt. for the next shots was made
and we were out the door, ready for our busy day. We were treated in a courteous,
professional manner and every question was answered to our satisfaction. It was
a very positive experience."</span>
<div style="margin-top: 15px;">
<div style="display: inline-block;" itemprop="author" itemscope itemtype="http://schema.org/Person">
Submitted by: <span itemprop="name">Pat & Frank</span></div>
</div>
</div>
</div>
</div>
<div class="review">
<div style="margin-bottom: 20px;" itemscope itemtype="http://schema.org/Review">
<div itemprop="itemReviewed" itemref="_name1" itemscope itemtype="http://schema.org/MedicalClinic">
</div>
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
...
JavaScript
var rvwList = $("#areaall .review").hide();
rvwList.slice(0, 2).show();
var size_li = rvwList.length;
var x = 2;
start = 0;
function showHide(){
if ( $("#areaall").children().last().index() == $("#areaall .review:visible").last().index())
{
$('.next').hide();
}
else if ($("#areaall").children().first().index() == $("#areaall .review:visible").first().index()) {
$('.prev').hide();
}
}
$('.next').click(function() {
$('.prev').show();
rvwList.slice(start, start + x).hide();
start += x;
rvwList.slice(start, start + x).show();
showHide();
console.log('size_li is:' + size_li);
console.log('start is:' + start);
//console.log('start is:' + end);
});
$('.prev').click(function() {
$('.next').show();
rvwList.slice(start, start + x).hide();
start -= x;
rvwList.slice(start, start + x).show();
showHide();
});