2012-09-18 53 views
1

我試圖使用本教程創建一個jQuery滑塊使用自定義手柄:jQuery UI的滑塊拒絕顯示自定義處理

http://papermashup.com/jquery-ui-slider/

在他們的演示頁它的工作原理,但是當我做了同樣的事情,它不顯示自定義句柄圖像。它正確顯示其他所有內容。下面是我使用的(你可以看到,在服務器上存在的圖像,並應顯示)的頁面:

http://jovansfreelance.com/stripe_pay/

這是應該顯示爲滑塊手柄上的圖像:

http://jovansfreelance.com/stripe_pay/images/slider-button.png

我在做什麼錯了?

回答

5

您忘記將代碼包裝在document.ready()調用中。您的代碼現在的方式是在頁面中存在元素之前嘗試執行。

嘗試:

$(document).ready(function(){ 
    $(".slider").slider({ 
      animate: true, 
       range: "min", 
       value: 50, 
       min: 10, 
       max: 100, 
       step: 10, 

       //this gets a live reading of the value and prints it on the page 
       slide: function(event, ui) { 
        $("#slider-result").html(ui.value); 
       }, 

       //this updates the hidden form field so we can submit the data using a form 
       change: function(event, ui) { 
       $('#hidden').attr('value', ui.value); 
       } 
    }); 
}); 
+0

還是同樣的錯誤。我的代碼在部分不像他們的,我不認爲這是問題。 – jovan

+0

哦,等等,就在這裏。現在工作。傻我。謝謝。 – jovan