How do I add a Marker to a jQuery UI Slider?

大憨熊 提交于 2019-11-30 08:22:53

问题


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" ) );

回答1:


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.



来源:https://stackoverflow.com/questions/4435437/how-do-i-add-a-marker-to-a-jquery-ui-slider

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!