Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit a7ad4bf

Browse files
committed
Merge pull request #31 from RunestoneInteractive/master
grabbing latest from master
2 parents 2a1a16d + dd43078 commit a7ad4bf

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

runestone/dragndrop/css/dragndrop.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.draggable {
22
margin-left: 2%;
33
margin-top: 5px;
4-
display:inline-block;
4+
display:inline;
5+
float:left;
56
text-align: left;
67
vertical-align: top;
78
background-color: #efefff;
@@ -10,7 +11,7 @@
1011
padding-bottom: 10px;
1112
min-width: 48%;
1213
max-width: 48%;
13-
border: 1px solid #efefff;;
14+
border: 1px solid #efefff;
1415
box-sizing: border-box;
1516
}
1617
.drag-button {

runestone/dragndrop/js/dragndrop.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,18 @@ DragNDrop.prototype.createNewElements = function () {
8282
$(this.containerDiv).text(this.question);
8383
this.containerDiv.appendChild(document.createElement("br"));
8484

85+
this.dragDropWrapDiv = document.createElement("div"); // Holds the draggables/dropzones, prevents feedback from bleeding in
86+
$(this.dragDropWrapDiv).css("display", "block");
87+
this.containerDiv.appendChild(this.dragDropWrapDiv);
88+
8589
this.draggableDiv = document.createElement("div");
8690
$(this.draggableDiv).addClass("draggable dragzone");
8791
this.addDragDivListeners();
8892

8993
this.dropZoneDiv = document.createElement("div");
9094
$(this.dropZoneDiv).addClass("draggable");
91-
this.containerDiv.appendChild(this.draggableDiv);
92-
this.containerDiv.appendChild(this.dropZoneDiv);
95+
this.dragDropWrapDiv.appendChild(this.draggableDiv);
96+
this.dragDropWrapDiv.appendChild(this.dropZoneDiv);
9397

9498
this.createButtons();
9599
this.checkLocalStorage();
@@ -100,8 +104,12 @@ DragNDrop.prototype.createNewElements = function () {
100104
if (!this.hasStoredDropzones) {
101105
this.minheight = $(this.draggableDiv).height();
102106
}
103-
104107
this.draggableDiv.style.minHeight = this.minheight.toString() + "px";
108+
if ($(this.dropZoneDiv).height() > this.minheight) {
109+
this.dragDropWrapDiv.style.minHeight = $(this.dropZoneDiv).height().toString() + "px";
110+
} else {
111+
this.dragDropWrapDiv.style.minHeight = this.minheight.toString() + "px";
112+
}
105113
};
106114

107115
DragNDrop.prototype.addDragDivListeners = function () {
@@ -368,7 +376,8 @@ DragNDrop.prototype.checkLocalStorage = function () {
368376
=================================*/
369377
$(document).ready(function () {
370378
$("[data-component=dragndrop]").each(function (index) {
371-
ddList[this.id] = new DragNDrop({"orig": this});
379+
if ($(this.parentNode).data("component") !== "timedAssessment") { // If this element exists within a timed component, don't render it here
380+
ddList[this.id] = new DragNDrop({"orig": this});
381+
}
372382
});
373-
374383
});

0 commit comments

Comments
 (0)