Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
AJYaBoi authored Aug 5, 2024
1 parent 3b5d513 commit eef68f9
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
}
.dvd {
position: absolute;
width: 300px; /* Set size */
height: 100px; /* Set size */
width: 300px; /* Updated size */
height: 100px; /* Updated size */
background-size: contain;
background-repeat: no-repeat;
}
Expand Down Expand Up @@ -52,24 +52,24 @@

function animate() {
// Boundary checks
if (x + dvd.clientWidth > window.innerWidth) {
if (x + dvd.clientWidth > window.innerWidth || x < 0) {
dx = -dx;
x = window.innerWidth - dvd.clientWidth; // Adjust position
if (x + dvd.clientWidth > window.innerWidth) {
x = window.innerWidth - dvd.clientWidth;
}
if (x < 0) {
x = 0;
}
changeImage();
}
if (x < 0) {
dx = -dx;
x = 0; // Adjust position
changeImage();
}
if (y + dvd.clientHeight > window.innerHeight) {
dy = -dy;
y = window.innerHeight - dvd.clientHeight; // Adjust position
changeImage();
}
if (y < 0) {
if (y + dvd.clientHeight > window.innerHeight || y < 0) {
dy = -dy;
y = 0; // Adjust position
if (y + dvd.clientHeight > window.innerHeight) {
y = window.innerHeight - dvd.clientHeight;
}
if (y < 0) {
y = 0;
}
changeImage();
}
x += dx;
Expand Down

0 comments on commit eef68f9

Please sign in to comment.