简体   繁体   English

自定义jQuery UI滑块

[英]customize jquery ui slider

$(document).ready(function(){

  var axis = $('.selector').draggable('option', 'axis');

      $("#draggable").draggable({ axis: 'x' });
      $('.selector').draggable('option', 'axis', 'x');

Js file ^ js文件^

  div.slider
    input(type="range" name="slider-1" id="slider-1" value="10" min="0" max="200" data-highlight="true")

Jade file ^ 玉锉^

So basically I have the slider working. 所以基本上我可以使用滑块。 I'm trying to add like circles/dots along the slider. 我试图沿着滑块添加类似圆圈/圆点。 So you can drag it to each of these along the slider. 因此,您可以将其沿滑块拖动到每个选项中。 The dots will influence something on the page. 点将影响页面上的某些内容。 But I can't find anything in the documentation about anything like this, can someone help? 但是我在文档中找不到类似这样的内容,有人可以帮忙吗? Thank you. 谢谢。

Refer this jsfiddle 引用此jsfiddle

var tot = total - 1;
var mar = $( ".ui-slider" ).width() / tot;

for (var x = 0; x < tot; x++){

    $(".ui-slider" ).append("<span class='dots' style='left:"+ x * mar + "px'></span>");
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM