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
d47ce20b
Commit
d47ce20b
authored
Jun 02, 2022
by
Muhammad Ameen
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Elevator Complete
parent
55488ffb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
167 additions
and
3 deletions
+167
-3
app.js
js/app.js
+158
-1
style.css
styles/style.css
+9
-2
No files found.
js/app.js
View file @
d47ce20b
// let floorsArrP = document.getElementById("floorsArr");
// let floorArr = [];
// let currentFloor = 4;
// let liftBox = document.getElementById("liftBox");
// let liftInner = document.getElementById("lift-inner");
// let btn0 = document.getElementById("btn0"),
// btn1 = document.getElementById("btn1"),
// btn2 = document.getElementById("btn2"),
// btn3 = document.getElementById("btn3"),
// btn4 = document.getElementById("btn4");
// function command(floorNo) {
// let checkNumber = floorArr.includes(floorNo);
// if (checkNumber === false && currentFloor !== floorNo) {
// floorArr.push(floorNo);
// floorsArrP.innerHTML = floorArr;
// }
// for (var i = 0; i < floorArr.length; i++) {
// if (floorArr[i] !== currentFloor) {
// switch (floorArr[i]) {
// case 0:
// btn0.style.backgroundColor = "red";
// break;
// case 1:
// btn1.style.backgroundColor = "red";
// break;
// case 2:
// btn2.style.backgroundColor = "red";
// console.log("first");
// break;
// case 3:
// btn3.style.backgroundColor = "red";
// break;
// case 4:
// btn4.style.backgroundColor = "red";
// break;
// default:
// break;
// }
// }
// }
// console.log(floorArr);
// if (floorArr.length === 1) {
// move();
// }
// }
// function move() {
// if (floorArr[0] === 0) {
// liftInner.style.backgroundPosition = "left bottom";
// liftBox.style.marginTop = "680px";
// liftBox.style.transition = "5s";
// currentFloor = 0;
// if (floorArr.length !== 0) {
// setTimeout(() => {
// floorArr.splice(0, 1);
// floorsArrP.innerHTML = floorArr;
// btn0.style.backgroundColor = "gray";
// move(floorArr[0]);
// }, 6000);
// setTimeout(() => {
// liftInner.style.backgroundPosition = "right bottom";
// }, 5000);
// }
// } else if (floorArr[0] === 1) {
// liftInner.style.backgroundPosition = "left bottom";
// liftBox.style.marginTop = "544px";
// liftBox.style.transition = "5s";
// currentFloor = 1;
// if (floorArr.length !== 0) {
// setTimeout(() => {
// floorArr.splice(0, 1);
// floorsArrP.innerHTML = floorArr;
// btn1.style.backgroundColor = "gray";
// liftInner.style.backgroundPosition = "right bottom";
// move(floorArr[0]);
// }, 6000);
// setTimeout(() => {
// liftInner.style.backgroundPosition = "right bottom";
// }, 5000);
// }
// } else if (floorArr[0] === 2) {
// liftInner.style.backgroundPosition = "left bottom";
// liftBox.style.marginTop = "408px";
// liftBox.style.transition = "5s";
// currentFloor = 2;
// if (floorArr.length !== 0) {
// setTimeout(() => {
// floorArr.splice(0, 1);
// floorsArrP.innerHTML = floorArr;
// btn2.style.backgroundColor = "gray";
// liftInner.style.backgroundPosition = "right bottom";
// move(floorArr[0]);
// }, 6000);
// setTimeout(() => {
// liftInner.style.backgroundPosition = "right bottom";
// }, 5000);
// }
// } else if (floorArr[0] === 3) {
// liftInner.style.backgroundPosition = "left bottom";
// liftBox.style.marginTop = "272px";
// liftBox.style.transition = "5s";
// currentFloor = 3;
// if (floorArr.length !== 0) {
// setTimeout(() => {
// floorArr.splice(0, 1);
// floorsArrP.innerHTML = floorArr;
// btn3.style.backgroundColor = "gray";
// liftInner.style.backgroundPosition = "right bottom";
// move(floorArr[0]);
// }, 6000);
// setTimeout(() => {
// liftInner.style.backgroundPosition = "right bottom";
// }, 5000);
// }
// } else if (floorArr[0] === 4) {
// liftInner.style.backgroundPosition = "left bottom";
// liftBox.style.marginTop = "0px";
// liftBox.style.transition = "5s";
// currentFloor = 4;
// if (floorArr.length !== 0) {
// setTimeout(() => {
// floorArr.splice(0, 1);
// floorsArrP.innerHTML = floorArr;
// btn4.style.backgroundColor = "gray";
// liftInner.style.backgroundPosition = "right bottom";
// move(floorArr[0]);
// }, 6000);
// setTimeout(() => {
// liftInner.style.backgroundPosition = "right bottom";
// }, 5000);
// }
// }
// }
let
floorsArrP
=
document
.
getElementById
(
"floorsArr"
);
let
floorArr
=
[];
let
currentFloor
=
4
;
...
...
@@ -10,6 +147,16 @@ let btn0 = document.getElementById("btn0"),
btn4
=
document
.
getElementById
(
"btn4"
);
function
command
(
floorNo
)
{
// let temp = 0;
// for (let i = 0; i < floorArr.length; i++) {
// for (let j = i + 1; j < floorArr.length; j++) {
// if (floorArr[i] > floorArr[j]) {
// temp = floorArr[i];
// floorArr[i] = floorArr[j];
// floorArr[j] = temp;
// }
// }
// }
let
checkNumber
=
floorArr
.
includes
(
floorNo
);
if
(
checkNumber
===
false
&&
currentFloor
!==
floorNo
)
{
floorArr
.
push
(
floorNo
);
...
...
@@ -117,7 +264,7 @@ function move() {
}
}
else
if
(
floorArr
[
0
]
===
4
)
{
liftInner
.
style
.
backgroundPosition
=
"left bottom"
;
liftBox
.
style
.
marginTop
=
"
136
px"
;
liftBox
.
style
.
marginTop
=
"
0
px"
;
liftBox
.
style
.
transition
=
"5s"
;
currentFloor
=
4
;
if
(
floorArr
.
length
!==
0
)
{
...
...
@@ -134,3 +281,13 @@ function move() {
}
}
}
for
(
let
i
=
0
;
i
<
floorArr
.
length
;
i
++
)
{
for
(
let
j
=
i
+
1
;
j
<
floorArr
.
length
;
j
++
)
{
if
(
arr
[
i
]
>
arr
[
j
])
{
temp
=
arr
[
i
];
arr
[
i
]
=
arr
[
j
];
arr
[
j
]
=
temp
;
}
}
}
styles/style.css
View file @
d47ce20b
...
...
@@ -19,6 +19,10 @@ body {
margin-bottom
:
20px
;
color
:
white
;
/* font-size: 24px; */
-webkit-box-shadow
:
1px
0px
17px
-1px
rgba
(
0
,
0
,
0
,
0.75
);
-moz-box-shadow
:
1px
0px
17px
-1px
rgba
(
0
,
0
,
0
,
0.75
);
box-shadow
:
1px
0px
17px
-1px
rgba
(
0
,
0
,
0
,
0.75
);
}
.btn_container
{
...
...
@@ -29,7 +33,10 @@ body {
}
.btn
:hover
{
background-color
:
red
;
background-color
:
orange
;
-webkit-box-shadow
:
1px
0px
7px
-1px
rgba
(
0
,
0
,
0
,
0.75
);
-moz-box-shadow
:
1px
0px
7px
-1px
rgba
(
0
,
0
,
0
,
0.75
);
box-shadow
:
1px
0px
7px
-1px
rgba
(
0
,
0
,
0
,
0.75
);
}
.floorBox
{
...
...
@@ -63,7 +70,7 @@ body {
background
:
linear-gradient
(
to
right
,
black
50%
,
white
50%
);
background-size
:
200%
100%
;
background-position
:
right
bottom
;
transition
:
all
.5s
ease-out
;
transition
:
all
0
.5s
ease-out
;
}
/* .lift:hover {
...
...
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