Files
Hi-School-Slide-Manager/mimic-carousel.html
T

215 lines
8.4 KiB
HTML

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<title>Carousel Mimic Test</title>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<style>
@font-face {
font-family: 'ETmodules';
src: url('http://hi-school-myhspstores.local/wp-content/themes/Divi/core/admin/fonts/modules/all/modules.ttf') format('truetype');
}
.et-pb-icon {
font-family: 'ETmodules' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
text-shadow: 0 0;
display: inline-block;
box-sizing: border-box;
direction: ltr;
}
body { font-family: sans-serif; background: #f4f4f4; padding: 20px; }
.carousel-wrapper { max-width: 1200px; margin: 0 auto; position: relative; overflow: hidden; }
/* Mimic Divi Carousel Classes */
.et_pb_group_carousel { position: relative; display: flex; flex-direction: column; }
.et_pb_group_carousel_container { position: relative; overflow: clip visible; width: 100%; }
.et_pb_group_carousel_track { display: flex; transition: transform 0.5s ease-in-out; }
.et_pb_group_carousel_slide { flex: 0 0 100%; min-width: 0; box-sizing: border-box; }
.et_pb_group {
min-height: 600px;
border-radius: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-size: cover;
background-position: center;
box-shadow: 0px 2px 18px 0px rgba(0,0,0,0.6);
color: white;
text-align: center;
overflow: hidden; /* Critical for rounded corners on backgrounds */
margin: 10px 20px;
}
.et_pb_module_header {
background: rgba(0,0,0,0.5);
padding: 10px 20px;
border-radius: 8px;
font-size: 24px;
}
.et_pb_group_carousel_arrow {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: red;
color: white;
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 10;
user-select: none;
font-size: 30px;
font-weight: bold;
}
.et_pb_group_carousel_arrow_prev { left: 10px; }
.et_pb_group_carousel_arrow_next { right: 10px; }
.et_pb_button {
display: inline-block;
margin-top: 20px;
padding: 10px 25px;
background: red;
color: white;
text-decoration: none;
border-radius: 5px;
font-weight: bold;
}
/* Mocking the fixed background class from the plugin */
.hssm-bg-fixed {
background-size: cover !important;
background-position: center !important;
}
</style>
</head>
<body>
<h1>Carousel Mimic for Testing</h1>
<div class="carousel-wrapper">
<div class="et_pb_group_carousel et_pb_group_carousel_0">
<div class="et_pb_group_carousel_container">
<div class="et_pb_group_carousel_track">
<!-- Slide 1 -->
<div class="et_pb_group_carousel_slide">
<div class="et_pb_group et_pb_group_0">
<h1 class="et_pb_module_header">Get A $25, $10 or $5 Reward</h1>
<a href="#" class="et_pb_button">Click Here</a>
</div>
</div>
<!-- Slide 2 -->
<div class="et_pb_group_carousel_slide">
<div class="et_pb_group et_pb_group_1">
<h1 class="et_pb_module_header">Tips For Caring For Your Houseplants During The Winter</h1>
<a href="#" class="et_pb_button">Click Here</a>
</div>
</div>
<!-- Slide 3 -->
<div class="et_pb_group_carousel_slide">
<div class="et_pb_group et_pb_group_2">
<h1 class="et_pb_module_header">Reach For Mucinex & Delsym For Cough and Congestion Relief</h1>
<a href="#" class="et_pb_button">Click Here</a>
</div>
</div>
<!-- Slide 4 (Ace Hardware Mock) -->
<div class="et_pb_group_carousel_slide">
<div class="et_pb_group et_pb_group_3">
<h1 class="et_pb_module_header">Ace Hardware - The Helpful Place</h1>
<a href="#" class="et_pb_button">Shop Now</a>
</div>
</div>
</div>
</div>
<div class="et_pb_group_carousel_arrow et_pb_group_carousel_arrow_prev" role="button"><span class="et-pb-icon">4</span></div>
<div class="et_pb_group_carousel_arrow et_pb_group_carousel_arrow_next" role="button"><span class="et-pb-icon">5</span></div>
</div>
</div>
<script>
$(document).ready(function() {
var $track = $('.et_pb_group_carousel_track');
var $slides = $('.et_pb_group_carousel_slide');
var currentIndex = 0;
var slideCount = $slides.length;
function updateCarousel() {
var offset = -currentIndex * 100;
$track.css('transform', 'translateX(' + offset + '%)');
}
$('.et_pb_group_carousel_arrow_next').click(function() {
currentIndex = (currentIndex + 1) % slideCount;
updateCarousel();
});
$('.et_pb_group_carousel_arrow_prev').click(function() {
currentIndex = (currentIndex - 1 + slideCount) % slideCount;
updateCarousel();
});
// Simulate the dynamic background fixing logic that the user is working on
// This is what they want to test.
var bgData = [
{
title: "Get A $25, $10 or $5 Reward",
bg: "http://hi-school-myhspstores.local/wp-content/uploads/2026/01/JOHNSON-JAN-BANNER-AUC-25YJGLA3676-KVU_SCDR_HiSchool_Q12026_printdig.jpg"
},
{
title: "Tips For Caring For Your Houseplants During The Winter",
bg: "http://hi-school-myhspstores.local/wp-content/uploads/2026/01/houseplant-winter-scaled.jpg"
},
{
title: "Reach For Mucinex & Delsym For Cough and Congestion Relief",
bg: "http://hi-school-myhspstores.local/wp-content/uploads/2026/01/rb-health-mucinex-delsym-january-banner.jpg"
},
{
title: "Ace Hardware - The Helpful Place",
bg: "http://hi-school-myhspstores.local/wp-content/uploads/2026/01/sale-weekly-coups.jpg"
}
];
function fixCarouselBgs() {
$('.et_pb_group_carousel_slide').each(function() {
var $slide = $(this);
var slideText = $slide.find('.et_pb_module_header').first().text().trim();
if (!slideText) return;
$.each(bgData, function(i, item) {
if (slideText.indexOf(item.title) !== -1 || item.title.indexOf(slideText) !== -1) {
$slide.find('.et_pb_group').first().css({
'background-image': 'url(' + item.bg + ')',
'background-size': 'cover',
'background-position': 'center',
'background-repeat': 'no-repeat'
}).addClass('hssm-bg-fixed');
}
});
});
}
// Run the fix
fixCarouselBgs();
});
</script>
</body>
</html>