简体   繁体   English

如何使范围滑块变慢?

[英]How do I make a range slider slower?

I made a range slider using html/css/js to go with my lua nui.我使用 html/css/js 制作了一个范围滑块来配合我的 lua nui。 It works great for the most part, but whenever I slide too quickly on the slider, it doesn't perform the function correctly.它在大多数情况下都很好用,但是每当我在滑块上滑动得太快时,它就无法正确执行该功能。 Whenever I slide my slider to the left, it makes certain values go down and up for the right.每当我将滑块向左滑动时,它会使某些值向右上下移动。 If I slide it too crazy, the values all go back to 0, so I figured if I could cap the speed at which the user can slide it, the function would never go wrong.如果我滑动它太疯狂,值都会回到 0,所以我想如果我可以限制用户滑动它的速度,这个功能永远不会出错。 Didn't find any relevant google searches for this, so I'd appreciate any replies.没有找到任何相关的谷歌搜索,所以我会很感激任何回复。 Also, I'm new to sliders so give me a break if this is a really dumb quesion.另外,我是滑块的新手,所以如果这是一个非常愚蠢的问题,请让我休息一下。 I'm more familiar with lua.我对lua比较熟悉。

the html html

<div class="slidecontainer" style="position: fixed;top:13%;left:5%;">
 <input type="range" min="0.0" max="10.0" value="5.0" class="slider" id="myRange">
</div>

the js js

 var slider = document.getElementById("myRange");
 slider.oninput = function() {
        if (slider.value >= 0.0 && slider.value < 1.0) {
            $.post('https://skineditor/changefaceshapemix', JSON.stringify({
                value: '1-10'
            }));
        } else if (slider.value > 1.0 && slider.value < 2.1) {
            $.post('https://skineditor/changefaceshapemix', JSON.stringify({
                value: '11-20'
            }));
// this keeps on going all the way to 10 (also i know that the string values are different)

how i have it right now is if the slider's value is anywhere between the numbers then it posts back to my lua and does a function我现在的方法是,如果滑块的值在数字之间的任何位置,那么它会回发到我的 lua 并执行一个功能

im not showing the lua because i've verified its not an issue with that code, my function only goes wrong if i slide too quick on the slider我没有显示 lua,因为我已经验证它不是该代码的问题,如果我在滑块上滑动得太快,我的功能只会出错

Please try to set $SlideDuration option.请尝试设置 $SlideDuration 选项。 Also you can try to set $Idle option.您也可以尝试设置 $Idle 选项。

SOLVED解决了

I used an alternative way of saving the value and using it with MySQL.我使用了另一种方法来保存值并将其与 MySQL 一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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