繁体   English   中英

我该如何制作此代码的轮播

[英]how can i make a carousel of 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));
            },

我有一个旋转木马。 并可以单击左右。 但是当我在左侧项目上时,左侧按钮将被隐藏。 当我位于右边的末尾时,右边的按钮也将被隐藏。 但是我该如何编写这段代码。 我有转盘吗?

我从您的话中了解到,当您将鼠标移到下一个/上一个图标时,它们会被隐藏。 您列表中有几项?

尝试注释以下行并运行应用程序

$('.link-next', this.$node).hide();
$('.link-prev', this.$node).hide();

不要删除仅对其发表评论,看看是否可以看到下一个/上一个图标?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM