Skip to content

Commit

Permalink
fixed the Previous Page button logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoey007 committed Nov 23, 2018
1 parent c54a448 commit 901ff91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ form .btn-success:focus {
ul.pager li span {
background-color: green;
color: white;
font-size: 16px;
font-size: 15px;
border-radius: 5px;
border: none;
}
Expand Down
18 changes: 7 additions & 11 deletions assets/javascript/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ function loaderStatusCheck() {
$("#loader").removeClass("hidden");
$("#next-events").addClass("hidden");
$("#previous-events").addClass("hidden");
} else if (showLoader == false) {
} else if (showLoader == false && pageNum == 1) {
$("#loader").addClass("hidden");
}
$("#previous-events").addClass("hidden");
} else if (showLoader == false && pageNum !== 1) {
$("#loader").addClass("hidden");
$("#previous-events").removeClass("hidden");
};
// alert("showLoader: " + showLoader);
console.log("showLoader: " + showLoader);
};
Expand Down Expand Up @@ -82,7 +86,7 @@ function queryEvents(eventType, address, noOfRecords, dateRange)
console.log("Event #" + (i+1) + " displayed.");
showLoader = false;
loaderStatusCheck();
addMoreEventBtn();
$("#next-events").removeClass("hidden");
};

});
Expand Down Expand Up @@ -111,14 +115,6 @@ function createEventDiv(event){
eventsHolder.append(eventDIV);
}

// Add More Event Button
function addMoreEventBtn() {
// setTimeout(function() {
$("#next-events").removeClass("hidden");
// }, 2000);
$("#previous-events").removeClass("hidden");
};

//TO DISPLAY THE SELECTED EVENT ADDRESS ON THE ADJACENT MAP
function displayAddressOnMap(item){
displayOnMap(item.getAttribute('data-info'));
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ <h4 class="search-heading">Filter by Category:</h4>
<div class="row">
<nav aria-label="...">
<ul class="pager">
<li class="previous" id="previous-events"><span aria-hidden="true">&larr; Previous Page</span></li>
<li class="next" id="next-events"><span aria-hidden="true">Next Page &rarr;</span></button>
<li class="previous hidden" id="previous-events"><span aria-hidden="true">&larr; Previous Page</span></li>
<li class="next hidden" id="next-events"><span aria-hidden="true">Next Page &rarr;</span></button>
</ul>
</nav>
</div>
Expand Down

0 comments on commit 901ff91

Please sign in to comment.