I need to create a custom volume slider for a WMP object. The current slider is complicated to modify, and use, is there a simple way to generate a slider on an HTML page that can have it's value passed to a javascript function?
-
7With HTML5, native sliders can be declared and CSS-styled. `` Try it! – Alba Mendez Jun 25 '12 at 18:52
-
But unfortunately doesn't work in Firefox yet :( – cprcrack Oct 25 '12 at 17:22
-
**HERE!!!!!!!!!!!!** - http://stackoverflow.com/questions/22904852/html-scroll-box-with-horizontal-controls-for-vertical-scrolling/ – T.Todua Jun 11 '14 at 17:06
-
Dupe of http://stackoverflow.com/q/14095880/1163000 – Taufik Nurrohman Jul 22 '16 at 19:13
-
@TaufikNurrohman You've got that backwards actually, this question was posted 4 years before the one you linked. The new one should likewise be closed. – UnkwnTech Jul 26 '16 at 00:12
-
Shield UI's Slider widget is what you need: http://demos.shieldui.com/web/slider/basic-usage – Vladimir Georgiev Nov 17 '16 at 12:25
13 Answers
hey i've just created my own JS slider because I had enough of the heavy Jquery UI one. Interested to hear people's thoughts. Been on it for 5 hours, so really really early stages.

- 16,256
- 10
- 67
- 90

- 985
- 7
- 10
-
Nice example - I'm looking for a control to fade the opacity of one image over another, so might try this. – Dave Everitt Jul 04 '12 at 17:58
-
Thanks for the example -- a lack of simple slider controls that are not part of some much larger library has been really annoying. This motivated me to try to just go write my own that meets my needs – Michael Wasser Oct 18 '12 at 17:47
-
For those of you wondering: WinXP/IE7 works great, WinXP/IE6 works but needs CSS tweaking, iOS5/Safari does not work (guess other touch devices won't either). For such a small piece of code it is very impressive, Great work Luc! thanks! – Xavi Esteve Oct 29 '12 at 13:50
-

- 5,729
- 5
- 34
- 38

- 197,344
- 39
- 212
- 226
-
5Doesn't work so nicely on mobile without the additional libraries of [jquery-touch-punch](https://github.com/furf/jquery-ui-touch-punch). And this also conflicts with `$.fn.button` from Twitter Bootstrap, so watch out. – Ehtesh Choudhury Feb 23 '13 at 00:47
A simple slider: I have just tested this in pure HTML5, and it's so simple !
<input type="range">
It works like a charm on Chrome. I've not tested other browsers yet.

- 38,876
- 35
- 121
- 169
-
-
2I think you should write `` inside an html file, and browse this file in a browser that accepts HTML5. You would see a simple slider. – Stephane Rolland Jul 03 '14 at 10:03
-
HTML 5 with Webforms 2 provides an <input type="range">
which will make the browser generate a native slider for you. Unfortunately all browsers doesn't have support for this, however google has implemented all Webforms 2 controls with js. IIRC the js is intelligent enough to know if the browser has implemented the control, and triggers only if there is no native implementation.
From my point of view it should be considered best practice to use the browsers native controls when possible.

- 1,196
- 7
- 10
There's a nice javascript slider, it's very easy to implement. You can download the zip package here: http://ruwix.com/javascript-volume-slider-control/
p.s. here the simplified version of the above script:

- 53,146
- 19
- 236
- 237

- 51
- 1
The lightweight MooTools framework has one: http://demos.mootools.net/Slider

- 137,716
- 26
- 137
- 190
The Carpe Slider has newer versions also:
v1.5 carpe_ambiprospect_slider
v2.0b ...slider/drafts/v2.0/

- 16,256
- 10
- 67
- 90

- 11
- 1
The code below should be enough to get you started. Tested in Opera, IE and Chrome.
<script>
var l=0;
function f(i){
im = 'i' + l;
d=document.all[im];
d.height=99;
document.all.f1.t1.value=i;
im = 'i' + i;
d=document.all[im];
d.height=1;
l=i;
}
</script>
<center>
<form id='f1'>
<input type=text value=0 id='t1'>
</form>
<script>
for (i=0;i<=50;i++)
{
s = "<img src='j.jpg' height=99 width=9 onMouseOver='f(" + i + ")' id='i" + i + "'>";
document.write(s);
}
</script>

- 27
- 1
-
14Inline events, `document.write`, the `
` element - it's like 1999 all over again! – Yi Jiang May 01 '12 at 10:37