I have this code:
initPrevNextButtons: function() {
$ ('.link-prev', this.$ node).click(this.prev.bind(this)).hide();
$ ('.link-next', this.$ node).click(this.next.bind(this));
},
prev: function(e) {
e.preventDefault();
this.currentPage--;
$ ('.link-next', this.$ node).show();
if (this.currentPage <= 0) {
this.currentPage = 0;
$ ('.link-prev', this.$ node).hide();
} else {
$ ('.link-prev', this.$ node).show();
};
var url = this.generateURL(true);
$ .get(url, this.write.bind(this));
},
next: function(e) {
e.preventDefault();
this.currentPage++;
$ ('.link-prev', this.$ node).show();
if (this.currentPage >= this.totalItems - 1) {
this.currentPage = this.totalItems - 1;
$ ('.link-next', this.$ node).hide();
} else {
$ ('.link-next', this.$ node).show();
};
var url = this.generateURL(true);
$ .get(url, this.write.bind(this));
},
I have a carousel. And can click to the right and left. But when i are on the left item. The left button wil be hide. And when i on the end of the right. The right button wil be hide. But how can i make this code. That i have a carousel?