如何将标记添加到jQuery UI Slider? [英] How do I add a Marker to a jQuery UI Slider?

查看:116
本文介绍了如何将标记添加到jQuery UI Slider?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的jQuery UI滑块,其数值范围为25到35.它工作正常,默认值为28.我希望在滑块上添加一个简单的刻度线,以指示28是默认是.是否有添加指标的简单方法?

$('#cycle_length').slider({
  range: "min",
  value: 28,
  min: 25,
  max: 35,
  step: 1,
  slide: function( event, ui ) {
    $( "#amount" ).val( ui.value );
  }
});
$( "#amount" ).val( $( "#cycle_length" ).slider( "value" ) );

解决方案

我在这里找到了jQuery UI滑块的出色实现:

http://www.filamentgroup.com/lab/update_jquery_ui_slider_from_a_select_element_now_with_aria_support/

它称为selectToSlider插件,它允许在滑块上放置刻度线,并可以添加标签和工具提示.

I have a simple jQuery UI slider that has a numerical range from 25 to 35. It works fine and the default value is 28. I'm hoping to add a simple tick mark to the slider to indicate that 28 is where the default is. Is there a simple way to add an indicator?

$('#cycle_length').slider({
  range: "min",
  value: 28,
  min: 25,
  max: 35,
  step: 1,
  slide: function( event, ui ) {
    $( "#amount" ).val( ui.value );
  }
});
$( "#amount" ).val( $( "#cycle_length" ).slider( "value" ) );

I found a great implementation of the jQuery UI slider here:

http://www.filamentgroup.com/lab/update_jquery_ui_slider_from_a_select_element_now_with_aria_support/

It's called the selectToSlider plugin and allows for the placement of tick marks throughout the slider as well as the ability to add labels and tooltips.

这篇关于如何将标记添加到jQuery UI Slider?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆