updating banner
This commit is contained in:
parent
944226ce7c
commit
8bddfce275
Binary file not shown.
@ -4,28 +4,123 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
{% get_current_language as CURRENT_LANG %}
|
{% get_current_language as CURRENT_LANG %}
|
||||||
{% if banners %}
|
{% if banners %}
|
||||||
<!-- Carousel Section -->
|
<!-- Custom Manual Slider Section -->
|
||||||
<section class="banner-carousel mb-4 mt-n1">
|
<style>
|
||||||
<div id="mainBannerCarousel" class="carousel slide" data-bs-ride="carousel" data-bs-pause="hover">
|
.custom-slider-container {
|
||||||
<div class="carousel-indicators">
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 450px;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
.custom-slide {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
transition: opacity 0.8s ease-in-out;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.custom-slide.active {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.custom-slider-indicators {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
z-index: 10;
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
.custom-slider-indicators button {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid #fff;
|
||||||
|
background: rgba(255,255,255,0.5);
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
.custom-slider-indicators button.active {
|
||||||
|
background: #fff;
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
|
.custom-slider-control {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
z-index: 10;
|
||||||
|
background: rgba(0,0,0,0.3);
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 50%;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: background 0.3s;
|
||||||
|
}
|
||||||
|
.custom-slider-control:hover {
|
||||||
|
background: rgba(0,0,0,0.6);
|
||||||
|
}
|
||||||
|
.custom-slider-prev { left: 20px; }
|
||||||
|
.custom-slider-next { right: 20px; }
|
||||||
|
|
||||||
|
.custom-caption {
|
||||||
|
background: rgba(0,0,0,0.6);
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
color: #fff;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 10px;
|
||||||
|
max-width: 600px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 60px;
|
||||||
|
z-index: 15;
|
||||||
|
}
|
||||||
|
[dir="ltr"] .custom-caption { left: 60px; text-align: left; }
|
||||||
|
[dir="rtl"] .custom-caption { right: 60px; text-align: right; }
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.custom-slider-container { height: auto; }
|
||||||
|
.custom-slide { position: relative; height: auto; display: none; }
|
||||||
|
.custom-slide.active { display: block; }
|
||||||
|
.custom-caption { position: static; max-width: 100%; border-radius: 0; background: #212529; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<section class="mb-4 mt-n1">
|
||||||
|
<div id="manualSlider" class="custom-slider-container">
|
||||||
|
<div class="custom-slider-indicators">
|
||||||
{% for banner in banners %}
|
{% for banner in banners %}
|
||||||
<button type="button" data-bs-target="#mainBannerCarousel" data-bs-slide-to="{{ forloop.counter0 }}" {% if forloop.first %}class="active" aria-current="true"{% endif %} aria-label="Slide {{ forloop.counter }}"></button>
|
<button type="button" class="{% if forloop.first %}active{% endif %}" data-idx="{{ forloop.counter0 }}"></button>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="carousel-inner">
|
|
||||||
|
<div class="custom-slides-wrapper">
|
||||||
{% for banner in banners %}
|
{% for banner in banners %}
|
||||||
<div class="carousel-item {% if forloop.first %}active{% endif %}" data-bs-interval="{% if 'ar' in CURRENT_LANG %}15000{% else %}10000{% endif %}">
|
<div class="custom-slide {% if forloop.first %}active{% endif %}" data-idx="{{ forloop.counter0 }}">
|
||||||
<div class="banner-wrapper position-relative" style="height: 450px; overflow: hidden; background-color: #000;">
|
<img src="{{ banner.image.url }}" class="w-100" style="height: 450px; object-fit: cover;" alt="{{ banner.display_title }}" {% if forloop.first %}loading="eager"{% endif %}>
|
||||||
<img src="{{ banner.image.url }}" class="d-block w-100 h-100" style="object-fit: cover;" alt="{{ banner.display_title }}">
|
<div class="custom-caption d-none d-md-block">
|
||||||
<div class="carousel-caption d-none d-md-block p-4 rounded" style="background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); max-width: 600px; position: absolute; bottom: 50px; {% if 'ar' in CURRENT_LANG %}right: 50px; text-align: right;{% else %}left: 50px; text-align: left;{% endif %}">
|
<h2 class="fw-bold display-6">{{ banner.display_title }}</h2>
|
||||||
<h2 class="fw-bold display-6">{{ banner.display_title }}</h2>
|
<p class="lead">{{ banner.display_subtitle }}</p>
|
||||||
<p class="lead">{{ banner.display_subtitle }}</p>
|
{% if banner.link %}
|
||||||
{% if banner.link %}
|
<a href="{{ banner.link }}" class="btn btn-primary btn-lg px-4">{% trans "Learn More" %}</a>
|
||||||
<a href="{{ banner.link }}" class="btn btn-primary btn-lg px-4">{% trans "Learn More" %}</a>
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Mobile caption visible only on small screens below the image -->
|
<!-- Mobile caption -->
|
||||||
<div class="d-md-none bg-dark text-white p-4 text-center">
|
<div class="d-md-none bg-dark text-white p-4 text-center">
|
||||||
<h3 class="fw-bold">{{ banner.display_title }}</h3>
|
<h3 class="fw-bold">{{ banner.display_title }}</h3>
|
||||||
<p>{{ banner.display_subtitle }}</p>
|
<p>{{ banner.display_subtitle }}</p>
|
||||||
@ -36,14 +131,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if banners.count > 1 %}
|
{% if banners.count > 1 %}
|
||||||
<button class="carousel-control-prev" type="button" data-bs-target="#mainBannerCarousel" data-bs-slide="prev">
|
<button class="custom-slider-control custom-slider-prev">
|
||||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
<i class="fa-solid fa-chevron-left"></i>
|
||||||
<span class="visually-hidden">Previous</span>
|
|
||||||
</button>
|
</button>
|
||||||
<button class="carousel-control-next" type="button" data-bs-target="#mainBannerCarousel" data-bs-slide="next">
|
<button class="custom-slider-control custom-slider-next">
|
||||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
<i class="fa-solid fa-chevron-right"></i>
|
||||||
<span class="visually-hidden">Next</span>
|
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@ -51,21 +145,65 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
var myCarousel = document.querySelector('#mainBannerCarousel');
|
const slider = document.getElementById('manualSlider');
|
||||||
if (myCarousel) {
|
if (!slider) return;
|
||||||
var carouselInstance = new bootstrap.Carousel(myCarousel, {
|
|
||||||
interval: {% if 'ar' in CURRENT_LANG %}15000{% else %}10000{% endif %},
|
const slides = slider.querySelectorAll('.custom-slide');
|
||||||
ride: 'carousel',
|
const indicators = slider.querySelectorAll('.custom-slider-indicators button');
|
||||||
pause: 'hover'
|
const prevBtn = slider.querySelector('.custom-slider-prev');
|
||||||
});
|
const nextBtn = slider.querySelector('.custom-slider-next');
|
||||||
|
|
||||||
|
let currentIdx = 0;
|
||||||
|
let isPaused = false;
|
||||||
|
const intervalTime = {% if 'ar' in CURRENT_LANG %}15000{% else %}10000{% endif %};
|
||||||
|
|
||||||
|
function showSlide(index) {
|
||||||
|
if (index === currentIdx) return;
|
||||||
|
|
||||||
// Force the first slide to show immediately
|
// Hide current
|
||||||
var firstItem = myCarousel.querySelector('.carousel-item.active');
|
slides[currentIdx].classList.remove('active');
|
||||||
if (firstItem) {
|
indicators[currentIdx].classList.remove('active');
|
||||||
firstItem.style.display = 'block';
|
|
||||||
firstItem.style.opacity = '1';
|
// Update index
|
||||||
}
|
currentIdx = (index + slides.length) % slides.length;
|
||||||
|
|
||||||
|
// Show next
|
||||||
|
slides[currentIdx].classList.add('active');
|
||||||
|
indicators[currentIdx].classList.add('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto-rotate
|
||||||
|
let slideInterval = setInterval(() => {
|
||||||
|
if (!isPaused) {
|
||||||
|
showSlide(currentIdx + 1);
|
||||||
|
}
|
||||||
|
}, intervalTime);
|
||||||
|
|
||||||
|
// Controls
|
||||||
|
if (prevBtn) {
|
||||||
|
prevBtn.addEventListener('click', () => {
|
||||||
|
showSlide(currentIdx - 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (nextBtn) {
|
||||||
|
nextBtn.addEventListener('click', () => {
|
||||||
|
showSlide(currentIdx + 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indicators
|
||||||
|
indicators.forEach((btn, idx) => {
|
||||||
|
btn.addEventListener('click', () => {
|
||||||
|
showSlide(idx);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hover pause
|
||||||
|
slider.addEventListener('mouseenter', () => isPaused = true);
|
||||||
|
slider.addEventListener('mouseleave', () => isPaused = false);
|
||||||
|
|
||||||
|
// Initial check to ensure first is visible
|
||||||
|
slides[0].classList.add('active');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -80,26 +80,6 @@ body {
|
|||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Carousel Adjustments - Minimalist */
|
|
||||||
.carousel-item {
|
|
||||||
transition: transform 1.2s ease-in-out, opacity 1.2s ease-in-out !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure active slide is visible */
|
|
||||||
.carousel-item.active {
|
|
||||||
display: block !important;
|
|
||||||
opacity: 1 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RTL Support for Carousel */
|
|
||||||
[dir="rtl"] .carousel-item {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
[dir="rtl"] .carousel-caption {
|
|
||||||
right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
background-color: var(--primary-color);
|
background-color: var(--primary-color);
|
||||||
color: var(--white);
|
color: var(--white);
|
||||||
|
|||||||
@ -80,26 +80,6 @@ body {
|
|||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Carousel Adjustments - Minimalist */
|
|
||||||
.carousel-item {
|
|
||||||
transition: transform 1.2s ease-in-out, opacity 1.2s ease-in-out !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure active slide is visible */
|
|
||||||
.carousel-item.active {
|
|
||||||
display: block !important;
|
|
||||||
opacity: 1 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RTL Support for Carousel */
|
|
||||||
[dir="rtl"] .carousel-item {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
[dir="rtl"] .carousel-caption {
|
|
||||||
right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
background-color: var(--primary-color);
|
background-color: var(--primary-color);
|
||||||
color: var(--white);
|
color: var(--white);
|
||||||
|
|||||||
1
subscription_check.log
Normal file
1
subscription_check.log
Normal file
@ -0,0 +1 @@
|
|||||||
|
Successfully checked subscriptions
|
||||||
Loading…
x
Reference in New Issue
Block a user