如何动态地向jQuery滑块添加多个句柄 [英] How to add multiple handles to a jQuery slider on the fly
本文介绍了如何动态地向jQuery滑块添加多个句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想这样做:
- 在某些事件下向jQuery滑块添加一个句柄
- 该手柄应具有ID,以便在滑动时可以访问其值. 任何想法如何做到这一点? 此处是JSfiddle中的代码,其中实现了带有两个句柄的滑块.我需要做的就是通过触发某些事件即时添加句柄,并获取每个句柄的值以供进一步利用.
- Add a handlle to a jQuery slider on some event
- That handle should have an id so that when it slides, I can access its value. Any ideas how to do this ? Here is the code in JSfiddle where a slider with two handles is implemented. All I need to do is add handles on the fly by some event triggered and get the values each handle for Further utilization.
推荐答案
I don't see any possibility according to the documentation on http://jqueryui.com/demos/slider/. You could destroy and recreate the slider when a value is added or removed. This requires you to store all current values of existing handles. Not a super elegant solution but it's the only one I currently see besides updating the jquery ui library.
我用一个简单的示例更新了您的小提琴: http://jsfiddle.net/FPCRb/4/
I updated your fiddle with a simple example: http://jsfiddle.net/FPCRb/4/
这篇关于如何动态地向jQuery滑块添加多个句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文