Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Elevator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Ameen
Elevator
Commits
44d9e905
Commit
44d9e905
authored
Jun 01, 2022
by
Muhammad Ameen
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue fix
parent
fc7bfc24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
27 deletions
+36
-27
index.html
index.html
+3
-1
app.js
js/app.js
+33
-26
No files found.
index.html
View file @
44d9e905
...
@@ -22,7 +22,9 @@
...
@@ -22,7 +22,9 @@
</div>
</div>
<div
class=
"floorBox"
>
<div
class=
"floorBox"
>
<div
class=
"lift"
id=
"liftBox"
></div>
<div
class=
"lift"
id=
"liftBox"
>
</div>
</div>
</div>
</div>
</div>
...
...
js/app.js
View file @
44d9e905
...
@@ -10,42 +10,47 @@ let btn0 = document.getElementById("btn0"),
...
@@ -10,42 +10,47 @@ let btn0 = document.getElementById("btn0"),
function
command
(
floorNo
)
{
function
command
(
floorNo
)
{
let
checkNumber
=
floorArr
.
includes
(
floorNo
);
let
checkNumber
=
floorArr
.
includes
(
floorNo
);
if
(
checkNumber
===
false
)
{
if
(
checkNumber
===
false
&&
currentFloor
!==
floorNo
)
{
floorArr
.
push
(
floorNo
);
floorArr
.
push
(
floorNo
);
floorsArrP
.
innerHTML
=
floorArr
;
floorsArrP
.
innerHTML
=
floorArr
;
}
}
if
(
floorArr
.
length
===
1
)
{
move
();
}
switch
(
floorNo
)
{
for
(
var
i
=
0
;
i
<
floorArr
.
length
;
i
++
)
{
case
0
:
if
(
floorArr
[
i
]
!==
currentFloor
)
{
btn0
.
style
.
backgroundColor
=
"red"
;
switch
(
floorArr
[
i
])
{
break
;
case
0
:
case
1
:
btn0
.
style
.
backgroundColor
=
"red"
;
btn1
.
style
.
backgroundColor
=
"red"
;
break
;
break
;
case
1
:
case
2
:
btn1
.
style
.
backgroundColor
=
"red"
;
btn2
.
style
.
backgroundColor
=
"red"
;
break
;
console
.
log
(
"first"
);
case
2
:
break
;
btn2
.
style
.
backgroundColor
=
"red"
;
case
3
:
console
.
log
(
"first"
);
btn3
.
style
.
backgroundColor
=
"red"
;
break
;
break
;
case
3
:
case
4
:
btn3
.
style
.
backgroundColor
=
"red"
;
btn4
.
style
.
backgroundColor
=
"red"
;
break
;
break
;
case
4
:
default
:
btn4
.
style
.
backgroundColor
=
"red"
;
break
;
break
;
default
:
break
;
}
}
}
}
console
.
log
(
floorArr
);
console
.
log
(
floorArr
);
if
(
floorArr
.
length
===
1
)
{
move
();
}
}
}
function
move
()
{
function
move
()
{
if
(
floorArr
[
0
]
===
0
)
{
if
(
floorArr
[
0
]
===
0
)
{
liftBox
.
style
.
marginTop
=
"680px"
;
liftBox
.
style
.
marginTop
=
"680px"
;
liftBox
.
style
.
transition
=
"5s"
;
liftBox
.
style
.
transition
=
"5s"
;
currentFloor
=
0
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
floorArr
.
length
!==
0
)
{
if
(
floorArr
.
length
!==
0
)
{
floorArr
.
splice
(
0
,
1
);
floorArr
.
splice
(
0
,
1
);
...
@@ -57,7 +62,7 @@ function move() {
...
@@ -57,7 +62,7 @@ function move() {
}
else
if
(
floorArr
[
0
]
===
1
)
{
}
else
if
(
floorArr
[
0
]
===
1
)
{
liftBox
.
style
.
marginTop
=
"544px"
;
liftBox
.
style
.
marginTop
=
"544px"
;
liftBox
.
style
.
transition
=
"5s"
;
liftBox
.
style
.
transition
=
"5s"
;
currentFloor
=
1
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
floorArr
.
length
!==
0
)
{
if
(
floorArr
.
length
!==
0
)
{
floorArr
.
splice
(
0
,
1
);
floorArr
.
splice
(
0
,
1
);
...
@@ -69,7 +74,7 @@ function move() {
...
@@ -69,7 +74,7 @@ function move() {
}
else
if
(
floorArr
[
0
]
===
2
)
{
}
else
if
(
floorArr
[
0
]
===
2
)
{
liftBox
.
style
.
marginTop
=
"408px"
;
liftBox
.
style
.
marginTop
=
"408px"
;
liftBox
.
style
.
transition
=
"5s"
;
liftBox
.
style
.
transition
=
"5s"
;
currentFloor
=
2
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
floorArr
.
length
!==
0
)
{
if
(
floorArr
.
length
!==
0
)
{
floorArr
.
splice
(
0
,
1
);
floorArr
.
splice
(
0
,
1
);
...
@@ -81,6 +86,7 @@ function move() {
...
@@ -81,6 +86,7 @@ function move() {
}
else
if
(
floorArr
[
0
]
===
3
)
{
}
else
if
(
floorArr
[
0
]
===
3
)
{
liftBox
.
style
.
marginTop
=
"272px"
;
liftBox
.
style
.
marginTop
=
"272px"
;
liftBox
.
style
.
transition
=
"5s"
;
liftBox
.
style
.
transition
=
"5s"
;
currentFloor
=
3
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
floorArr
.
length
!==
0
)
{
if
(
floorArr
.
length
!==
0
)
{
floorArr
.
splice
(
0
,
1
);
floorArr
.
splice
(
0
,
1
);
...
@@ -92,6 +98,7 @@ function move() {
...
@@ -92,6 +98,7 @@ function move() {
}
else
if
(
floorArr
[
0
]
===
4
)
{
}
else
if
(
floorArr
[
0
]
===
4
)
{
liftBox
.
style
.
marginTop
=
"136px"
;
liftBox
.
style
.
marginTop
=
"136px"
;
liftBox
.
style
.
transition
=
"5s"
;
liftBox
.
style
.
transition
=
"5s"
;
currentFloor
=
4
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
floorArr
.
length
!==
0
)
{
if
(
floorArr
.
length
!==
0
)
{
floorArr
.
splice
(
0
,
1
);
floorArr
.
splice
(
0
,
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment