Skip to content

Commit

Permalink
Merge pull request akshitagupta15june#718 from manasi-jain/main
Browse files Browse the repository at this point in the history
Implemented dynamic background image slideshow in main section
  • Loading branch information
akshitagupta15june authored Jun 11, 2023
2 parents d61c809 + c971217 commit 40bfc4d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
Binary file added Assets/Images/main-heading-body-bg2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Images/main-heading-body-bg3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Images/main-heading-body-bg4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,20 @@ function googleTranslateElementInit() {
);
}

var imageIndex = 0;
var imagesArray = [
"url('./Assets/Images/main-heading-body-bg.jpg') center",
"url('./Assets/Images/main-heading-body-bg2.png') center",
"url('./Assets/Images/main-heading-body-bg3.png') center",
"url('./Assets/Images/main-heading-body-bg4.png') center"
];

function changeBackground() {
var index = imageIndex++ % imagesArray.length;
document.querySelector(".main-body-section-div").style.background = imagesArray[index];
}

document.addEventListener("DOMContentLoaded", function() {
document.querySelector(".main-body-section-div").style.background = imagesArray[0];
setInterval(changeBackground, 2000);
});
9 changes: 6 additions & 3 deletions introSection.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
}

/* CORRECT THE HERO IMAGE: I also changed the height to a 850px to give clearer view of the cute puppies */
.main-body-section-div {
background: url("./Assets/Images/main-heading-body-bg.jpg") no-repeat center
center/cover;
.main-body-section-div{
/* background: url("./Assets/Images/main-heading-body-bg.jpg") no-repeat center
center/cover; */
background-repeat: no-repeat!important;
background-size: cover!important;
min-height: 850px;
opacity: 0.9;
padding-top: 80px;
transition: background 0.6s ease-in-out;
}

.main-body-heading-text {
Expand Down

0 comments on commit 40bfc4d

Please sign in to comment.