Okay, I want to control the volume of an HTML5 element using the jQuery Slider element. I have implemented the slide, but can’t figure out how to make the value of the slider take the place of the “audio player.volume = ?”.
Any help is much appreciated.
The
volumeproperty is like opacity, it goes between zero and one, one being 100%.Your code is so close, you just need to divide
valueby100when setting the volume of the<audio>element:Notice I also put the
changeevent handler inside the initialization of thesliderwidget.When I paste the above code along into the console while on your webpage, and the volume slider worked as expected.
Also, you can bind to the
slideevent and the volume will change as the user slides thesliderwidget, not just after they finish moving the handle: