2012-07-26 67 views

回答

1

在這裏你去:http://jsfiddle.net/JCTJj/19/

$(function() { 
    var webSlider = document.getElementById('volume'); 
    var output = $('#gain'); 
    var sliderParams = { 
     'orientation': "vertical", 
     'range': "min", 
     'min': 0, 
     'max': 1, 
     'animate': false, 
     'step': 0.01, 
     'slide': function(event, ui) { 
      window.gainNode.gain.value = ui.value; 
      output.val(window.gainNode.gain.value); 
     }, 
     'stop': function(event, ui) { 
      console.log(window.gainNode.gain.value); 
     } 
    }; 

    $('#sliderOne').slider(sliderParams); 
    webSlider.addEventListener('change', function() { 
     window.gainNode.gain.value = this.value; 
     output.val(window.gainNode.gain.value); 
    }); 
}); 
1

你的收益函數應該收到類似

function gain(value) { 

    gainNode.gain.value = value; 
} 

值然後在jQuery的滑塊做類似

slide: function(event, ui) { 

    gain(ui.value);      
}