+
+
+
+
+
+
diff --git a/09week/towers-of-hanoi/script.js b/09week/towers-of-hanoi/script.js
index ba46e37e29..3ab32508f9 100644
--- a/09week/towers-of-hanoi/script.js
+++ b/09week/towers-of-hanoi/script.js
@@ -1,5 +1,23 @@
'use strict';
$(document).ready(function() {
- // Put app logic here
+ $('.draggable').draggable({
+ revert: "invalid"
+ });
+
+ $('#dropArea, #dropArea2, #dropArea3').droppable({
+ drop: function(event, ui) {
+ let drag = $(ui.draggable).data('block');
+ console.log(`current block ${drag}`);
+ let last = $(this).children().last().data('block');
+ console.log(`last ${last}`);
+ if ((drag) > (last)) {
+ $(ui.draggable).draggable('option', 'revert', true);
+ } else {
+ $(ui.draggable).appendTo($(this)).attr('style', 'position: relative');
+ }
+ }
+ });
});
+
+