2012-10-02 29 views
0

我在項目中使用nivo滑塊。我發現有必要使用公共職能進行上一個和下一個工作。也就是說方向導航應該從代碼中任何地方的滑塊外部工作。有可能使用nivo滑塊嗎?如何將Nivo Slider API用於next-prev?

回答

2

你是否想要做類似的事情?

$("#previousButton, #nextButton").click(function (e) { 

     // Prevent the link from being followed 
     e.preventDefault(); 

     // Initialize variables 
     var buttonId = this.id, 
      buttonClass = ("previousButton" == buttonId) ? ".nivo-prevNav" : ".nivo-nextNav"; 

     // Trigger the slider button 
     $(".nivo-directionNav").find(buttonClass).click(); 
    }); 
+0

是的,我剛剛發現這個工作。 無論如何感謝:) http://stackoverflow.com/questions/6835236/external-controls-next-prev-for-nivo-slider-raphaeljs – Daljit