我怎样才能使这个代码
问题描述:
的旋转木马我有这样的代码:我怎样才能使这个代码
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));
},
我有一个转盘。并可以点击左侧和右侧。但是,当我在左边的项目。左边的按钮将被隐藏。当我在右边的结尾。右键将被隐藏。但是我怎么能做这个代码。我有一个旋转木马?
答
我的理解是,当你将鼠标移到他们身上时,你的下一个/上一个图标会被隐藏。你有多少项目在列表中?
尝试注释以下行并运行应用程序
$('.link-next', this.$node).hide();
$('.link-prev', this.$node).hide();
不要删除评论只是他们,看看你能看到一个/上一个图标?