Skip to content

Instantly share code, notes, and snippets.

@Heavyblade
Created June 4, 2013 19:59
Show Gist options
  • Select an option

  • Save Heavyblade/5709058 to your computer and use it in GitHub Desktop.

Select an option

Save Heavyblade/5709058 to your computer and use it in GitHub Desktop.
$('.viewingtask').droppable
accept: '.color-swatch'
tolerance: 'touch'
over: -> #when you hover over it lightens up
$(this).addClass('lighten')
out: -> #when you hover out it goes back to normal
$(this).removeClass('lighten')
greedy: true
drop: (e, ui) ->
if ui.helper.hasClass('color-swatch')
color = $(ui.helper).data('color')
classes = $(".ui-dialog-titlebar").attr "class"
new_classes = classes.replace(/top-\w+(\s*|$)/g, "") + "top-" + color
$(this).find(".ui-dialog-titlebar").attr("class", new_classes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment