Skip to content

Commit 0c5fea2

Browse files
committed
update 1.6
1 parent c4a4f03 commit 0c5fea2

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

script.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ for (i = 0; i < 5; i++) {
1212
box.className = "box";
1313
box.style.height = num;
1414
box.style.width = num2;
15-
var text = document.createTextNode(n);
15+
var text = document.createTextNode(".");
1616
text.className = "label";
1717
box.appendChild(text);
1818
var arraybox = document.getElementById("arraybox");
@@ -37,7 +37,7 @@ slider.oninput = function() {
3737
box.className = "box";
3838
box.style.height = num;
3939
box.style.width = num2;
40-
var text = document.createTextNode(n);
40+
var text = document.createTextNode(".");
4141
text.className = "label";
4242
box.appendChild(text);
4343
var arraybox = document.getElementById("arraybox");
@@ -91,20 +91,28 @@ async function BubbleSort() {
9191
for (i = 0; i < lastUnsorted; i++) {
9292
a = removePx(myCollection[i].style.height);
9393
b = removePx(myCollection[i+1].style.height);
94-
94+
9595
if (b > a) {
96-
myCollection[i].style.background = "black";
96+
myCollection[i].style.background = "green";
97+
myCollection[i].style.color = "green";
98+
myCollection[i+1].style.background = "red";
99+
myCollection[i+1].style.color = "red";
97100
await Swap(i, i + 1);
98101
isSorted = 0;
99-
myCollection[i].style.background = "bisque";
102+
myCollection[i].style.background = "bisque";
103+
myCollection[i].style.color = "bisque";
104+
myCollection[i+1].style.background = "bisque";
105+
myCollection[i+1].style.color = "bisque";
100106
}
101107

102108
}
103109
myCollection[i].style.background = "cyan";
110+
myCollection[i].style.color = "cyan";
104111
lastUnsorted--;
105112
}
106113
for (i = 0; i < myCollection.length; i++) {
107114
myCollection[i].style.background = "cyan";
115+
myCollection[i].style.color = "cyan";
108116
}
109117
}
110118

style.css

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ p {
5656
padding: 5px;
5757
margin: 2px;
5858
display: inline-block;
59-
background: bisque;
59+
background: bisque;
60+
transform: rotate(-180deg);
61+
color: bisque;
6062
}
6163

6264
#arraybox {
@@ -70,9 +72,3 @@ p {
7072
transform: rotate(180deg);
7173
}
7274

73-
#label {
74-
writing-mode: vertical-lr;
75-
transform: rotate(-180deg);
76-
color: bisque;
77-
}
78-

0 commit comments

Comments
 (0)