2012-07-12 66 views

回答

2

看一看the source code on Guthub,我不知道Photoswipe但我不得不在源一眼,發現如下:

/* 
    * Function: previous 
    */ 
    previous: function(){ 

     if (this.isZoomActive()){ 
      return; 
     } 

     if (!Util.isNothing(this.carousel)){ 
      this.carousel.previous(); 
     } 

    }, 



    /* 
    * Function: next 
    */ 
    next: function(){ 

     if (this.isZoomActive()){ 
      return; 
     } 

     if (!Util.isNothing(this.carousel)){ 
      this.carousel.next(); 
     } 

    } 

你可能想看看在代碼中引用相應的轉盤功能以上。

+0

我已經看過這種方法。 – user823415 2012-07-12 16:29:19

+0

我已經看過這種方法。但我的問題是調用這個方法。 例如,我創建了一個按鈕,並且這必須執行一個操作方法(例如Next) – user823415 2012-07-13 07:08:28

+0

您可能需要再看一下@generalchaos答案,他似乎已經爲您解決了它。如果是這種情況,你應該接受他的回答:) – 2013-05-28 11:08:06

1

的PhotoSwipe文檔顯示你如何實例代碼:

// Set up PhotoSwipe with all anchor tags in the Gallery container 
$(document).ready(function(){ 

    var myPhotoSwipe = $("#Gallery a").photoSwipe({ enableMouseWheel: false , enableKeyboard: false }); 

}); 

要轉到下一個圖像,簡單的調用 '下一步' 您photoSwipe實例作爲這樣的:

myPhotoSwipe.next(); 

OR'以前'回去

myPhotoSwipe.previous(); 

正如Denoir所說(謝謝!)。

希望這會有所幫助。 乾杯。