gpt4 book ai didi

jquery - slider ,如何更改 “step” 大小 - JQuery

转载 作者:行者123 更新时间:2023-12-01 01:37:48 25 4
gpt4 key购买 nike

我想做点什么:http://astro.unl.edu/naap/hr/animations/hrExplorer.html

这个示例是在 Flash 中进行的,但我是在 JQuery 中进行的。

查看我的代码:http://jsfiddle.net/NYZrz/9/

我在使用 slider “步骤”时遇到问题。在第一个链接中,值从 1.0 开始,最小值=0.00010,最大值:1000000

我想要水平 slider 看起来像:

0.00010 | 0.00012 | 0.00012 0.00014 | 0.00017 | 0.00017 ....| 0.0090 | 0.0090 0.011 | 0.011 .... | 0.10 | 0.10 0.12 | 0.12 0.14 | 0.14 ... | 1.0 | 1.2 | 1.2 1.4 | 1.4 ... | 9.0 | 11 | 11 13 | 16 | 16 .... | 5400 | 5400 ... | 1000000

但是我的代码没有这样做。

你能帮我吗?

谢谢......

最佳答案

使用num.toPrecision(2)而不是toFixed始终获得 2 位有效数字。我updated your fiddle .

编辑。要使数字低于 10,很简单:

var _num = (num < 10) ? num.toPrecision(2) : Math.round(num)

( num < 10 而不是 num < 1 )

updated your fiddle again .

关于jquery - slider ,如何更改 “step” 大小 - JQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9007156/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com