Skip to content

Commit 9e80b8a

Browse files
committed
Rotating images
1 parent 39f038f commit 9e80b8a

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

_data/team-imgs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- https://raw.githubusercontent.com/CabrilloRoboticsClub/cabrillorobotics.github.io/41309abdbb5d93dbc6c0119bf8f97a3bb38ad743/assets/images/seahawk-II/gallery-seahawk-II/interview.webp
2+
- https://raw.githubusercontent.com/CabrilloRoboticsClub/cabrillorobotics.github.io/41309abdbb5d93dbc6c0119bf8f97a3bb38ad743/assets/images/seahawk-II/gallery-seahawk-II/stack.webp
3+
- https://github.com/CabrilloRoboticsClub/cabrillorobotics.github.io/blob/258a1699f10c378fb2a1d18c2a986080bf3b6a57/assets/images/seahawk-II/gallery-seahawk-II/deploy.jpeg?raw=true
4+
- https://raw.githubusercontent.com/CabrilloRoboticsClub/cabrillorobotics.github.io/782b579c031c16835e0fee2b57a22246c1a79618/assets/images/seahawk-II/gallery-seahawk-II/product-demo-pilot-2.webp

_includes/team-showcase.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<section class="hero is-halfheight has-text-left" id="team-showcase">
2-
<figure class="hero-background" style="background-image: url('https://raw.githubusercontent.com/CabrilloRoboticsClub/cabrillorobotics.github.io/41309abdbb5d93dbc6c0119bf8f97a3bb38ad743/assets/images/seahawk-II/gallery-seahawk-II/interview.webp');">
2+
<figure class="hero-background" id="rotating-image">
33
<div class="overlay">
44
<div class="container is-centered">
55
<div class="title-text">
@@ -12,3 +12,26 @@ <h1 class="title has-text-white-ter is-size-1 is-uppercase has-text-weight-bold"
1212
</figure>
1313
</section>
1414

15+
<script>
16+
document.addEventListener('DOMContentLoaded', function() {
17+
const images = [
18+
{% for image in site.data.team-imgs %}
19+
"{{ image.url }}"{% unless forloop.last %},{% endunless %}
20+
{% endfor %}
21+
];
22+
23+
let currentIndex = 0;
24+
const imageElement = document.getElementById('rotating-image');
25+
26+
function rotateImage() {
27+
imageElement.style.backgroundImage = `url(${images[currentIndex]})`;
28+
currentIndex = (currentIndex + 1) % images.length;
29+
}
30+
31+
// Rotate the image every 5 seconds
32+
setInterval(rotateImage, 5000);
33+
34+
// Set the initial image
35+
rotateImage();
36+
});
37+
</script>

_layouts/team.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
<body>
1313
{% include navbar.html %}
14+
{% include team-showcase.html %}
1415
<section class="section has-text-centered has-background-black-bis" id="team">
1516
<div class="container">
16-
{% include team-showcase.html %}
17+
1718
<!-- <h2 class="title has-text-left has-text-white-ter is-size-2 has-text-weight-bold mgb-medium">
1819
Our Team
1920
</h2> -->

0 commit comments

Comments
 (0)