Skip to content

Instantly share code, notes, and snippets.

@kulesa
Created July 5, 2010 08:03
Show Gist options
  • Save kulesa/464125 to your computer and use it in GitHub Desktop.
Save kulesa/464125 to your computer and use it in GitHub Desktop.
hoursMins: (quarters) ->
addLeadingZero: (n) ->
if n.toString().length is 1 then "0$n" else "$n"
hours: addLeadingZero( Math.floor( quarters / 4))
mins: addLeadingZero( quarters*15 - hours * 60)
"$hours:$mins"
addSlider: () ->
$("#slider-range").slider {
range: true,
min: 0,
max: 96,
values: [32, 88],
slide: (event, ui) ->
$("#amount").val(hoursMins(ui.values[0]) + ' - ' + hoursMins(ui.values[1]))
}
$("#amount").val('$' + $("#slider-range").slider("values", 0) + ' - $' + $("#slider-range").slider("values", 1))
$(addSlider())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment