简体   繁体   中英

How do I get slider to go to specific position on tap on ipad. HTML Javascript

On safari desktop the slider one can click with the mouse to go to specific position on the slider. For instance you can click to go to the end. On the ipad you have to drag it the round ball with your finger to move the position of the slider. I would like on an ipad to be able to tap to get it to a specific position like on the desktop.

The code I'm using for the slider is

<input id = "slider" type="range" min="0" max="45" step="1" value="0" OnChange = "Slider();">

I would like to avoid using jquery but if I have to I will use jquery.

I know you asked for something not JQuery, but you should see how well the slider works. Also to note, an input of type range is not compatible with IE9 and below.

Fiddle

$("#slider ").slider({
    min: 0,
    max: 45,
    step:1,
    slide: function (event, ui) {
        $("#amount").val(ui.value);
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM