Jquery UI 滑块 - 输入值截断 3.40 -> 3.4
我正在尝试解决一个问题。当我加入步进时,可以说 0.01 一切都很好。但是,如果它落在 1 上,则会打印 1 而不是 1.00,并且 3.40 会打印为 3.4。
我已在 ui.slider.js 的各个位置添加了 toFixed(2),但尚未找到进行此修复的正确位置。
任何人都可以阐明这个问题。
此致, 罗伯特·库欣 开发商: Brilliance.com
I am trying to resolve an issue. When I put in stepping, lets say .01 everything works great. However, if it lands on 1 it prints 1 instead of 1.00, as well as 3.40 prints as 3.4.
I have added toFixed(2) in various places of ui.slider.js, but have not found the correct location to make this fix.
Can anyone shed light to this question.
Best Regards,
Robert Cushing
Developer: Brilliance.com
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解你的问题,你想查询滑块的值并以特定格式将其显示在其他地方(滑块不会在任何地方显示该值)。注入格式化逻辑的时间点是在查询滑块之后并将其显示在其他地方之前(注意:这意味着您不编辑 ui.slider.js)。类似于:
如果您尝试在滑块
change
事件中执行此操作,则当前值将作为函数的参数提供给您。例子:If I understand your question, you want to query the value of a slider and display it somewhere else in a specific format (the slider doesn't display the value anywhere). The point where you inject your formatting logic is after you query the slider and before you display it somewhere else (note: this means you do NOT edit ui.slider.js). Something like:
If you're attempting to do this inside the sliders
change
event, then the current value is provided to you as a parameter of your function. Example: