-->

Is there a simple JavaScript slider? [closed]

2019-01-21 08:56发布

问题:

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?

回答1:

jQuery UI Slider (API docs)



回答2:

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.

jsfiddle_slider



回答3:

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.



回答4:

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.



回答5:

Here is another light JavaScript Slider that seems to fit your needs.



回答6:

Yahoo UI library has also a slider control...



回答7:

script.aculo.us has a slider control that might be worth checking out.



回答8:

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



回答9:

I recommend Slider from Filament Group, It has very good user experience

http://www.filamentgroup.com/lab/update_jquery_ui_slider_from_a_select_element_now_with_aria_support/



回答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:

DEMO link



回答11:

The Carpe Slider has newer versions also:
v1.5 carpe_ambiprospect_slider v2.0b ...slider/drafts/v2.0/



回答12:

Here is a simple slider object for easy to use

pagecolumn_webparts_sliders



回答13:

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>