Reprototyping of scoreboard without bootstrap carousel
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
#scoreboard-container {
|
||||
display: flex;
|
||||
transition: transform 0.5s ease;
|
||||
}
|
||||
|
||||
.league-container {
|
||||
display: flex;
|
||||
justify-content: flex-start; /* Align cards to the left */
|
||||
|
||||
border: 1px solid rgb(206, 202, 202);
|
||||
}
|
||||
|
||||
/* Styling for each card representing a live game */
|
||||
#game-card {
|
||||
flex: 0 0 auto;
|
||||
border: 1px solid #ccc;
|
||||
padding: 20px; /* Increase padding to increase the apparent height */
|
||||
margin: 10px 10px;
|
||||
min-height: 100px; /* Set a minimum height for the cards */
|
||||
min-width: 150px;
|
||||
box-sizing: border-box; /* Include padding and border in the element's total width and height */
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const carouselInner = document.querySelector('#scoreboard-container');
|
||||
const carouselItems = Array.from(carouselInner.children);
|
||||
const carouselControlPrev = document.querySelector('.carousel-control-prev');
|
||||
const carouselControlNext = document.querySelector('.carousel-control-next');
|
||||
let currentIndex = 0;
|
||||
|
||||
const updateCarousel = () => {
|
||||
carouselItems.forEach((item, index) => {
|
||||
if (index === currentIndex) {
|
||||
item.classList.add('active');
|
||||
} else {
|
||||
item.classList.remove('active');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
carouselControlPrev.addEventListener('click', () => {
|
||||
if (currentIndex > 0) {
|
||||
currentIndex--;
|
||||
updateCarousel();
|
||||
}
|
||||
});
|
||||
|
||||
carouselControlNext.addEventListener('click', () => {
|
||||
if (currentIndex < carouselItems.length - 1) {
|
||||
currentIndex++;
|
||||
updateCarousel();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="h-100">
|
||||
|
||||
{{> live-scoreboard}}
|
||||
{{> live-scoreboard/live-scoreboard}}
|
||||
<!-- TODO: Add the head.hbs partial here -->
|
||||
{{> head}}
|
||||
|
||||
|
||||
@@ -3,6 +3,20 @@
|
||||
© 2024 - CSCI 3308 Group 6
|
||||
</p>
|
||||
|
||||
<!-- TODO: Add the <script><script /> tag to include bootstrap javascript -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||
<!-- Include Bootstrap JavaScript -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".carousel-control-prev").click(function() {
|
||||
$("#carouselExampleControls").carousel("prev");
|
||||
});
|
||||
|
||||
$(".carousel-control-next").click(function() {
|
||||
$("#carouselExampleControls").carousel("next");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user