Skip to content

Instantly share code, notes, and snippets.

@stuartbates
Created September 18, 2015 13:25
Show Gist options
  • Save stuartbates/480269b113ded140b209 to your computer and use it in GitHub Desktop.
Save stuartbates/480269b113ded140b209 to your computer and use it in GitHub Desktop.
var $ = require('jquery');
require('jquery-ui/draggable');
require('jquery-ui/droppable');
require('remodal');
$(document).ready(function(){
$('.draggable').draggable();
$('.droppable').droppable({
drop: function(event, ui){
if ( $(this).data('answer') === ui.draggable.data('answer') ){
ui.draggable.addClass('correct-answer');
} else {
ui.draggable.addClass('incorrect-answer');
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment