Skip to content

Instantly share code, notes, and snippets.

@adatta02
Created January 14, 2013 20:24
Show Gist options
  • Save adatta02/4533052 to your computer and use it in GitHub Desktop.
Save adatta02/4533052 to your computer and use it in GitHub Desktop.
Use jQuery UI slider and Bootstrap tooltips
$("#user-score-div").slider({
max: 100, min: 0, value: val,
change: function(e, ui){
$("#custom_segment_minimum_user_score").val( ui.value );
},
slide: function(e, ui){
var pos = $.extend({}, $(ui.handle).offset(),
{ width: $(ui.handle).get(0).offsetWidth,
height: $(ui.handle).get(0).offsetHeight});
var actualWidth = $(".tooltip:first").get(0).offsetWidth;
$(".tooltip:first").css("left", pos.left + pos.width / 2 - actualWidth / 2);
$(".tooltip:first .tooltip-inner").text( ui.value );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment