feat:added slider.html

This commit is contained in:
rajesh.n 2025-09-23 16:08:37 +05:30
parent 29b4677f49
commit d362a0c76b

639
slider.html Normal file
View File

@ -0,0 +1,639 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unstop Style Slider</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background-color: #f5f7fa;
padding: 40px 20px;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.slider-container {
max-width: 1200px;
width: 100%;
position: relative;
background: transparent;
}
.slider-wrapper {
overflow: hidden;
position: relative;
}
.slider-track {
display: flex;
transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
gap: 20px;
padding: 0 10px;
}
.slide {
min-width: calc(50% - 10px);
background: white;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
transition: transform 0.3s ease, box-shadow 0.3s ease;
position: relative;
}
.slide:hover {
transform: translateY(-2px);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}
/* First slide - Infosys style */
.slide:nth-child(1) .slide-content {
background: linear-gradient(135deg, #FF6B47 0%, #FF8E53 100%);
color: white;
padding: 40px 30px;
position: relative;
height: 280px;
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
}
.slide:nth-child(1) .slide-brand {
position: absolute;
top: 20px;
right: 25px;
background: rgba(255, 255, 255, 0.2);
padding: 8px 12px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
}
.slide:nth-child(1) .slide-title {
font-size: 28px;
font-weight: 700;
line-height: 1.3;
margin-bottom: 15px;
z-index: 2;
position: relative;
}
.slide:nth-child(1) .slide-subtitle {
background: #00D4AA;
color: white;
padding: 8px 16px;
border-radius: 20px;
font-size: 14px;
font-weight: 600;
display: inline-block;
margin-bottom: 15px;
}
.slide:nth-child(1) .slide-hashtags {
display: flex;
flex-wrap: wrap;
gap: 8px;
font-size: 13px;
opacity: 0.9;
}
.slide:nth-child(1) .slide-hashtags span {
color: #FFE5B4;
}
.slide:nth-child(1) .slide-graphics {
position: absolute;
right: -20px;
bottom: -20px;
width: 200px;
height: 150px;
opacity: 0.3;
}
.slide:nth-child(1) .slide-graphics::before {
content: '';
position: absolute;
width: 60px;
height: 60px;
background: #00D4AA;
border-radius: 50%;
top: 20px;
right: 40px;
transform: rotate(45deg);
}
.slide:nth-child(1) .slide-graphics::after {
content: '';
position: absolute;
width: 80px;
height: 80px;
border: 3px solid #FFE5B4;
border-radius: 50%;
bottom: 30px;
right: 20px;
}
/* Second slide - HDFC Life style */
.slide:nth-child(2) .slide-content {
background: linear-gradient(135deg, #E8E3FF 0%, #F0EBFF 100%);
color: #333;
padding: 30px;
position: relative;
height: 280px;
display: flex;
flex-direction: column;
}
.slide:nth-child(2) .slide-header {
display: flex;
align-items: center;
gap: 15px;
margin-bottom: 20px;
}
.slide:nth-child(2) .slide-logo {
font-size: 24px;
font-weight: 700;
color: #6B46C1;
}
.slide:nth-child(2) .slide-version {
background: #6B46C1;
color: white;
padding: 4px 12px;
border-radius: 20px;
font-size: 14px;
font-weight: 600;
}
.slide:nth-child(2) .slide-title {
font-size: 22px;
font-weight: 700;
color: #1F2937;
margin-bottom: 8px;
}
.slide:nth-child(2) .slide-subtitle {
font-size: 16px;
color: #6B7280;
margin-bottom: 20px;
}
.slide:nth-child(2) .slide-features {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 20px;
}
.slide:nth-child(2) .feature-item {
display: flex;
align-items: center;
gap: 10px;
font-size: 14px;
color: #374151;
}
.slide:nth-child(2) .feature-item::before {
content: '✓';
background: #10B981;
color: white;
width: 20px;
height: 20px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: bold;
}
.slide:nth-child(2) .slide-register {
background: #EF4444;
color: white;
padding: 10px 20px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
text-align: center;
position: absolute;
bottom: 20px;
right: 20px;
}
.slide:nth-child(2) .slide-brand-logo {
position: absolute;
top: 20px;
right: 20px;
width: 60px;
height: 40px;
background: #DC2626;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 12px;
border-radius: 4px;
}
.slide:nth-child(2) .slide-people {
position: absolute;
bottom: 80px;
right: 80px;
width: 80px;
height: 60px;
background: linear-gradient(45deg, #6B46C1, #8B5CF6);
border-radius: 8px;
opacity: 0.8;
}
/* Navigation buttons */
.nav-button {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: white;
border: 1px solid #E5E7EB;
width: 48px;
height: 48px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
color: #6B7280;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
z-index: 10;
}
.nav-button:hover {
background: #F9FAFB;
color: #374151;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.nav-button:active {
transform: translateY(-50%) scale(0.95);
}
.prev-btn {
left: -60px;
}
.next-btn {
right: -60px;
}
.nav-button::before {
content: '';
width: 8px;
height: 8px;
border-top: 2px solid currentColor;
border-right: 2px solid currentColor;
}
.prev-btn::before {
transform: rotate(-135deg);
margin-left: 2px;
}
.next-btn::before {
transform: rotate(45deg);
margin-right: 2px;
}
/* Dots indicator */
.dots-container {
display: flex;
justify-content: center;
gap: 8px;
margin-top: 30px;
}
.dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #D1D5DB;
cursor: pointer;
transition: all 0.3s ease;
}
.dot.active {
background: #6366F1;
transform: scale(1.25);
}
.dot:hover {
background: #9CA3AF;
}
/* Responsive design */
@media (max-width: 768px) {
.slide {
min-width: 100%;
}
.slider-track {
gap: 0;
padding: 0;
}
.nav-button {
width: 40px;
height: 40px;
font-size: 16px;
}
.prev-btn {
left: -50px;
}
.next-btn {
right: -50px;
}
.slide:nth-child(1) .slide-content,
.slide:nth-child(2) .slide-content {
height: 250px;
padding: 25px;
}
.slide:nth-child(1) .slide-title {
font-size: 24px;
}
.slide:nth-child(2) .slide-title {
font-size: 20px;
}
}
@media (max-width: 480px) {
.prev-btn {
left: -25px;
}
.next-btn {
right: -25px;
}
}
</style>
</head>
<body>
<div class="slider-container">
<div class="slider-wrapper">
<div class="slider-track" id="sliderTrack">
<!-- Slide 1 - Infosys Style -->
<div class="slide">
<div class="slide-content">
<div class="slide-brand">Infosys</div>
<div>
<h3 class="slide-title">RISE ABOVE EVERY HURDLE.<br>SET NEW HEIGHTS IN MOTION.</h3>
<div class="slide-subtitle">#EmployeesonthePlatforms2024 is here!</div>
<div class="slide-hashtags">
<span>#ThriveAtInfosys</span>
<span>#OpportunityMatters</span>
</div>
</div>
<div class="slide-graphics"></div>
</div>
</div>
<!-- Slide 2 - HDFC Life Style -->
<div class="slide">
<div class="slide-content">
<div class="slide-brand-logo">HDFC Life</div>
<div class="slide-header">
<div class="slide-logo">aspire 2.0</div>
<div class="slide-version"></div>
</div>
<div>
<div class="slide-title">Crack Challenges<br>& Win Big</div>
<div class="slide-subtitle">Case study competition brought to you by HDFC Life</div>
<div class="slide-features">
<div class="feature-item">Young qualifying students</div>
<div class="feature-item">Award finale with INR 1.5L membership</div>
<div class="feature-item">Cash Prize worth Rs 1.5 Lakh</div>
</div>
</div>
<div class="slide-register">Register on Unstop</div>
<div class="slide-people"></div>
</div>
</div>
<!-- Slide 3 - Additional slide -->
<div class="slide">
<div class="slide-content" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 40px 30px; height: 280px; display: flex; flex-direction: column; justify-content: space-between;">
<div style="position: absolute; top: 20px; right: 25px; background: rgba(255,255,255,0.2); padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600;">TechCorp</div>
<div>
<h3 style="font-size: 28px; font-weight: 700; line-height: 1.3; margin-bottom: 15px;">INNOVATE. CREATE.<br>TRANSFORM THE FUTURE.</h3>
<div style="background: #00D4AA; color: white; padding: 8px 16px; border-radius: 20px; font-size: 14px; font-weight: 600; display: inline-block; margin-bottom: 15px;">#TechInnovation2024</div>
<div style="display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; opacity: 0.9;">
<span style="color: #FFE5B4;">#FutureReady</span>
<span style="color: #FFE5B4;">#Innovation</span>
</div>
</div>
</div>
</div>
<!-- Slide 4 - Additional slide -->
<div class="slide">
<div class="slide-content" style="background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%); color: #333; padding: 30px; height: 280px; display: flex; flex-direction: column;">
<div style="position: absolute; top: 20px; right: 20px; width: 60px; height: 40px; background: #e17055; color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; border-radius: 4px;">StartupXYZ</div>
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 20px;">
<div style="font-size: 24px; font-weight: 700; color: #e17055;">launchpad 3.0</div>
<div style="background: #e17055; color: white; padding: 4px 12px; border-radius: 20px; font-size: 14px; font-weight: 600;"></div>
</div>
<div>
<div style="font-size: 22px; font-weight: 700; color: #2d3436; margin-bottom: 8px;">Build Your Startup<br>& Scale Fast</div>
<div style="font-size: 16px; color: #636e72; margin-bottom: 20px;">Entrepreneurship program for aspiring founders</div>
<div style="display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px;">
<div style="display: flex; align-items: center; gap: 10px; font-size: 14px; color: #2d3436;">
<span style="background: #00b894; color: white; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold;"></span>
Mentorship from industry experts
</div>
<div style="display: flex; align-items: center; gap: 10px; font-size: 14px; color: #2d3436;">
<span style="background: #00b894; color: white; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold;"></span>
Funding opportunities up to $50K
</div>
</div>
</div>
<div style="background: #e17055; color: white; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; text-align: center; position: absolute; bottom: 20px; right: 20px;">Apply Now</div>
</div>
</div>
</div>
</div>
<button class="nav-button prev-btn" id="prevBtn" aria-label="Previous slide"></button>
<button class="nav-button next-btn" id="nextBtn" aria-label="Next slide"></button>
<div class="dots-container" id="dotsContainer"></div>
</div>
<script>
class UnstopSlider {
constructor() {
this.track = document.getElementById('sliderTrack');
this.slides = document.querySelectorAll('.slide');
this.prevBtn = document.getElementById('prevBtn');
this.nextBtn = document.getElementById('nextBtn');
this.dotsContainer = document.getElementById('dotsContainer');
this.currentIndex = 0;
this.slidesToShow = window.innerWidth <= 768 ? 1 : 2;
this.totalSlides = this.slides.length;
this.maxIndex = Math.ceil(this.totalSlides / this.slidesToShow) - 1;
this.autoPlayInterval = null;
this.isAutoPlaying = true;
this.init();
}
init() {
this.createDots();
this.updateSlider();
this.bindEvents();
this.startAutoPlay();
}
createDots() {
this.dotsContainer.innerHTML = '';
const totalDots = this.maxIndex + 1;
for (let i = 0; i < totalDots; i++) {
const dot = document.createElement('div');
dot.classList.add('dot');
if (i === 0) dot.classList.add('active');
dot.addEventListener('click', () => this.goToSlide(i));
this.dotsContainer.appendChild(dot);
}
}
updateSlider() {
const translateX = -this.currentIndex * (100 / this.slidesToShow);
this.track.style.transform = `translateX(${translateX}%)`;
const dots = this.dotsContainer.querySelectorAll('.dot');
dots.forEach((dot, index) => {
dot.classList.toggle('active', index === this.currentIndex);
});
}
nextSlide() {
this.currentIndex = this.currentIndex >= this.maxIndex ? 0 : this.currentIndex + 1;
this.updateSlider();
}
prevSlide() {
this.currentIndex = this.currentIndex <= 0 ? this.maxIndex : this.currentIndex - 1;
this.updateSlider();
}
goToSlide(index) {
this.currentIndex = index;
this.updateSlider();
this.restartAutoPlay();
}
startAutoPlay() {
this.autoPlayInterval = setInterval(() => {
if (this.isAutoPlaying) {
this.nextSlide();
}
}, 3000);
}
stopAutoPlay() {
if (this.autoPlayInterval) {
clearInterval(this.autoPlayInterval);
this.autoPlayInterval = null;
}
}
restartAutoPlay() {
this.stopAutoPlay();
this.startAutoPlay();
}
bindEvents() {
this.nextBtn.addEventListener('click', () => {
this.nextSlide();
this.restartAutoPlay();
});
this.prevBtn.addEventListener('click', () => {
this.prevSlide();
this.restartAutoPlay();
});
this.track.parentElement.addEventListener('mouseenter', () => {
this.isAutoPlaying = false;
});
this.track.parentElement.addEventListener('mouseleave', () => {
this.isAutoPlaying = true;
});
document.addEventListener('keydown', (e) => {
if (e.key === 'ArrowLeft') {
this.prevSlide();
this.restartAutoPlay();
} else if (e.key === 'ArrowRight') {
this.nextSlide();
this.restartAutoPlay();
}
});
let startX = 0;
let endX = 0;
this.track.addEventListener('touchstart', (e) => {
startX = e.touches[0].clientX;
});
this.track.addEventListener('touchend', (e) => {
endX = e.changedTouches[0].clientX;
const diffX = startX - endX;
if (Math.abs(diffX) > 50) {
if (diffX > 0) {
this.nextSlide();
} else {
this.prevSlide();
}
this.restartAutoPlay();
}
});
window.addEventListener('resize', () => {
const newSlidesToShow = window.innerWidth <= 768 ? 1 : 2;
if (newSlidesToShow !== this.slidesToShow) {
this.slidesToShow = newSlidesToShow;
this.maxIndex = Math.ceil(this.totalSlides / this.slidesToShow) - 1;
this.currentIndex = Math.min(this.currentIndex, this.maxIndex);
this.createDots();
this.updateSlider();
}
});
}
}
document.addEventListener('DOMContentLoaded', () => {
new UnstopSlider();
});
</script>
</body>
</html>