Commit ccdd61a5 by Xavier Antoviaque

Merge pull request #13 from dragonfi/close-feedback-popup

Make popup close on click to anywhere else.
parents 4085f3ee 05b675bb
......@@ -102,7 +102,7 @@ function DragAndDropBlock(runtime, element) {
$dropzone.on('drop', clk.drop.success);
$dropzone.on('dropover', clk.drop.hover);
$(".close", _fn.$popup).on('click', clk.popup.close);
$(document).on('click', clk.popup.close);
_fn.$reset_button.on('click', clk.problem.reset);
},
problem: {
......@@ -117,6 +117,16 @@ function DragAndDropBlock(runtime, element) {
},
popup: {
close: function(event, ui) {
target = $(event.target);
popup_box = ".xblock--drag-and-drop .popup";
close_button = ".xblock--drag-and-drop .popup .close";
if (target.is(popup_box)) {
return;
};
if (target.parents(popup_box).length>0 && !target.is(close_button)) {
return;
};
_fn.$popup.hide();
publish_event({
event_type: 'xblock.drag-and-drop-v2.feedback.closed',
......@@ -127,6 +137,8 @@ function DragAndDropBlock(runtime, element) {
},
drag: {
start: function(event, ui) {
_fn.clickHandlers.popup.close(event, ui);
target = $(event.currentTarget);
target.removeClass('within-dropzone fade');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment