jQuery Bootstrap 滑块控件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16621916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 17:28:52  来源:igfitidea点击:

Bootstrap Slider Controls?

javascriptjquerytwitter-bootstrap

提问by K20GH

I'm currently using http://www.eyecon.ro/bootstrap-slider/which works a treat, however i'd like to output the value in realtime to an input box.

我目前正在使用http://www.eyecon.ro/bootstrap-slider/,它很有效,但是我想将值实时输出到输入框。

The js does this to a tooltip which is fine, however once you leave the slider, you can't see what you set it to. Any suggestions?

js 对工具提示执行此操作,这很好,但是一旦您离开滑块,就看不到您将其设置为什么。有什么建议?

回答by techfoobar

You can log the slider value at real time using the slideevent that is supplied with the plugin.

您可以使用slide随插件提供的事件实时记录滑块值。

See this demo: http://jsfiddle.net/vMLPF/1/

看到这个演示http: //jsfiddle.net/vMLPF/1/

Code:

代码

$('#foo').slider().on('slide', function(_ev) {
    $('#bar').val(_ev.value);
});

In the above code, #barrepresents the input box in which you want to show the slider value in real time.

在上面的代码中,#bar表示要实时显示滑块值的输入框。