2011-10-05 186 views
0

的旋轉木馬我有這樣的代碼:我怎樣才能使這個代碼

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)); 
      }, 

我有一個轉盤。並可以點擊左側和右側。但是,當我在左邊的項目。左邊的按鈕將被隱藏。當我在右邊的結尾。右鍵將被隱藏。但是我怎麼能做這個代碼。我有一個旋轉木馬?

回答

0

我的理解是,當你將鼠標移到他們身上時,你的下一個/上一個圖標會被隱藏。你有多少項目在列表中?

嘗試註釋以下行並運行應用程序

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

不要刪除評論只是他們,看看你能看到一個/上一個圖標?