Fixing hide/show of next/prev buttons

This commit is contained in:
misfir3 2016-11-15 21:01:16 -05:00
parent 0285bf96a7
commit ec2fc5a77c

View File

@ -112,6 +112,7 @@ define(['jquery',
addPaginationControls: function() { addPaginationControls: function() {
var pagingControlsDiv var pagingControlsDiv
this.$el.html(); this.$el.html();
// remove this.$prevPageButton refs ??? hide/show not really working
this.$prevPageButton = $('<span>',{class:'glyphicon-class glyphicon glyphicon-circle-arrow-left show-prev-page'}); this.$prevPageButton = $('<span>',{class:'glyphicon-class glyphicon glyphicon-circle-arrow-left show-prev-page'});
this.$prevPageButton.unbind().on('click',this.decrementPageView.bind(this)); this.$prevPageButton.unbind().on('click',this.decrementPageView.bind(this));
@ -124,12 +125,30 @@ define(['jquery',
pagingControlsDiv.append(this.$nextPageButton); pagingControlsDiv.append(this.$nextPageButton);
this.$el.append(pagingControlsDiv); this.$el.append(pagingControlsDiv);
} }
//
this.$prevPageButton.hide();
if (this.numPages > 0 ) { if (this.numPages > 0 ) {
this.$nextPageButton.show(); this.$nextPageButton.show();
} }
this.$prevPageButton.hide();
},
showPrevPageButton: function() {
$('span.glyphicon-class.glyphicon.glyphicon-circle-arrow-left.show-prev-page').show();
},
hidePrevPageButton: function() {
$('span.glyphicon-class.glyphicon.glyphicon-circle-arrow-left.show-prev-page').hide();
},
showNextPageButton: function() {
$('span.glyphicon-class.glyphicon.glyphicon-circle-arrow-right.show-next-page').show();
},
hideNextPageButton: function() {
$('span.glyphicon-class.glyphicon.glyphicon-circle-arrow-right.show-next-page').hide();
}, },
incrementPageView: function() { incrementPageView: function() {
@ -139,12 +158,12 @@ define(['jquery',
} }
if (this.currentPage > 0) { if (this.currentPage > 0) {
this.$prevPageButton.show(); this.showPrevPageButton();
} }
if (this.currentPage >= this.numPages -1) { if (this.currentPage >= this.numPages -1) {
this.$nextPageButton.hide(); this.hideNextPageButton();
this.$prevPageButton.show() this.showPrevPageButton;
} }
}, },
@ -155,12 +174,12 @@ define(['jquery',
} }
if (this.currentPage < this.numPages -1) { if (this.currentPage < this.numPages -1) {
this.$nextPageButton.show(); this.showNextPageButton();
} }
if (this.currentPage == 0) { if (this.currentPage == 0) {
this.$prevPageButton.hide(); this.hidePrevPageButton();
this.$nextPageButton.show(); this.showNextPageButton()
} }
}, },
@ -168,10 +187,6 @@ define(['jquery',
showCurContentPage: function(isIncrement) { showCurContentPage: function(isIncrement) {
this.$contentPages.hide(); this.$contentPages.hide();
this.$el.find(this.$contentPages[this.currentPage]).show(); this.$el.find(this.$contentPages[this.currentPage]).show();
},
hideNextPageButton: function() {
} }
}); });