2014-02-17 67 views
0

我使用的是Jquery Knob,它可以在頁面加載時自動運行。我似乎無法找出在這個功能中插入航點呼叫的位置。任何建議,非常感謝。用Waypoint啓動jquery動畫

  <script> 
       $(document)(function() { 
        $('.dial').knob({ 
         min: '0', 
         max: '100', 
         readOnly: true 
        }); 

        $('.dial').each(function(){ 
         $(this).animate({ 
          value: $(this).data('number') 
         },{ 
          duration: 950, 
          easing: 'swing', 
          progress: function() { 
           $(this).val(Math.round(this.value)).trigger('change'); 
          } // progress:function 
         }); // middle 
        }); //dial.each.function 
       }); // function 
       </script> 

回答

0

以下應該工作。

$(document)(function() { 
    $('.thing').waypoint(function(direction) { // Change ".thing" to the div class containing your knobs // 
     $('.dial').knob({ 
      min: '0', 
      max: '100', 
      readOnly: true 
     }); 

    $('.dial').each(function(){ 
     $(this).animate({ 
     value: $(this).data('number') 
     },{ 
      duration: 950, 
      easing: 'swing', 
      progress: function() { 
      $(this).val(Math.round(this.value)).trigger('change'); 
      } // progress:function 
      }); // middle 
     }); //dial.each.function 
    }); 
}); // function