var initialValue = [2, 10];
var sliderTooltip = function (event, ui) {
for (var i = 0; i < initialValue.length; i++) {
var curValue = ui.value || initialValue[i];
var target = ui.handle || $('.ui-slider-handle')[i];
var tooltip;
if (parseInt(curValue) == curValue) {
tooltip = '<span class="tooltip-time">' + curValue + ':00</span>';
} else {
tooltip = '<span class="tooltip-time">' + (curValue-0.5) + ':30</span>';
}
$(target).html(tooltip);
}
};
$(".update-time").slider({
range: true,
min: 0,
max: 24,
step: 0.5,
values: initialValue,
create: sliderTooltip,
slide: sliderTooltip
});
jQuery UI Slider组件 设置两个tooltip
最新推荐文章于 2024-04-02 13:45:25 发布