html input range step as an array of values

前端 未结 4 694
太阳男子
太阳男子 2020-12-05 22:17

I\'ve been playing around with the input type=range for the first time, and ideally I\'d like to set the step value to an array of values. I looked over the spe

4条回答
  •  感动是毒
    2020-12-05 22:32

    Having the next input:

        
        
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
        
    

    Here is my function to change the steps by 1 (0-10) and 10 (10-60)

    function toggleSteps(element) {
        var minutes = parseInt(element.value);
        if (minutes > 10) {
            element.step = 10;
        } else {
            element.step = 1;
        }
    }
    

提交回复
热议问题