timer for slider increased-banner
This commit is contained in:
parent
7c05f59159
commit
9178b9ca55
@ -1,82 +1,49 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import Link from "next/link";
|
import Link from "next/link"
|
||||||
import { Autoplay, Navigation, Pagination } from "swiper/modules";
|
import { Autoplay, Navigation, Pagination } from "swiper/modules"
|
||||||
import { Swiper, SwiperSlide } from "swiper/react";
|
import { Swiper, SwiperSlide } from "swiper/react"
|
||||||
import { motion } from "framer-motion";
|
|
||||||
|
|
||||||
import "swiper/css";
|
|
||||||
import "swiper/css/navigation";
|
|
||||||
import "swiper/css/pagination";
|
|
||||||
|
|
||||||
const swiperOptions = {
|
const swiperOptions = {
|
||||||
modules: [Autoplay, Pagination, Navigation],
|
modules: [Autoplay, Pagination, Navigation],
|
||||||
slidesPerView: 1,
|
slidesPerView: 1,
|
||||||
spaceBetween: 0,
|
spaceBetween: 0,
|
||||||
autoplay: {
|
autoplay: {
|
||||||
delay: 5000,
|
delay: 7000,
|
||||||
disableOnInteraction: false,
|
disableOnInteraction: false,
|
||||||
},
|
},
|
||||||
loop: true,
|
loop: true,
|
||||||
|
|
||||||
|
// Navigation
|
||||||
navigation: {
|
navigation: {
|
||||||
nextEl: '.h1n',
|
nextEl: '.h1n',
|
||||||
prevEl: '.h1p',
|
prevEl: '.h1p',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Pagination
|
||||||
pagination: {
|
pagination: {
|
||||||
el: '.swiper-pagination',
|
el: '.swiper-pagination',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
},
|
},
|
||||||
};
|
|
||||||
|
|
||||||
// Animation variants for full slide
|
|
||||||
const variants = {
|
|
||||||
topToBottom: {
|
}
|
||||||
hidden: { y: -300, opacity: 0 },
|
|
||||||
visible: { y: 0, opacity: 1, transition: { duration: 1, ease: "easeOut" } },
|
|
||||||
},
|
|
||||||
bottomToTop: {
|
|
||||||
hidden: { y: 300, opacity: 0 },
|
|
||||||
visible: { y: 0, opacity: 1, transition: { duration: 1, ease: "easeOut" } },
|
|
||||||
},
|
|
||||||
leftToRight: {
|
|
||||||
hidden: { x: -400, opacity: 0 },
|
|
||||||
visible: { x: 0, opacity: 1, transition: { duration: 1, ease: "easeOut" } },
|
|
||||||
},
|
|
||||||
rightToLeft: {
|
|
||||||
hidden: { x: 400, opacity: 0 },
|
|
||||||
visible: { x: 0, opacity: 1, transition: { duration: 1, ease: "easeOut" } },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Banner() {
|
export default function Banner() {
|
||||||
const [activeIndex, setActiveIndex] = useState(0);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="banner-style-two p_relative">
|
<section className="banner-style-two p_relative">
|
||||||
<Swiper
|
<Swiper {...swiperOptions} className="banner-carousel owl-theme owl-carousel owl-nav-none owl-dots-none">
|
||||||
{...swiperOptions}
|
<SwiperSlide className="slide-item">
|
||||||
className="banner-carousel owl-theme owl-carousel owl-nav-none owl-dots-none"
|
|
||||||
onSwiper={(swiper) => {
|
|
||||||
setActiveIndex(swiper.realIndex || 0);
|
|
||||||
}}
|
|
||||||
onSlideChange={(swiper) => {
|
|
||||||
setActiveIndex(swiper.realIndex || 0);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* Slide 1 - Top to Bottom */}
|
|
||||||
<SwiperSlide>
|
|
||||||
<motion.div
|
|
||||||
className="slide-item"
|
|
||||||
initial="hidden"
|
|
||||||
animate={activeIndex === 0 ? "visible" : "hidden"}
|
|
||||||
variants={variants.topToBottom}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className="bg-layer"
|
className="bg-layer"
|
||||||
style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-1.webp)' }}
|
style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-1.webp)' }}
|
||||||
></div>
|
></div>
|
||||||
|
<div className="bg-layer" style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-1.webp)', backgroundPosition: '75% center' }}></div>
|
||||||
|
{/* <figure className="image-layer"><img src="/assets/images/home/banner/banner-img-1.webp" alt="" /></figure> */}
|
||||||
<div className="auto-container">
|
<div className="auto-container">
|
||||||
<div className="content-box custom-content-box mobile-style">
|
<div className="content-box custom-content-box" style={{ background: 'white', borderRadius: '15%', opacity: 0.8 }}>
|
||||||
|
|
||||||
<span className="upper-text">The Journey to Better Health Begins here</span>
|
<span className="upper-text">The Journey to Better Health Begins here</span>
|
||||||
<h2>Your Path to <span>Recovery</span> Starts Today</h2>
|
<h2>Your Path to <span>Recovery</span> Starts Today</h2>
|
||||||
<p>Expert Physiotherapy in Mississauga for You.</p>
|
<p>Expert Physiotherapy in Mississauga for You.</p>
|
||||||
@ -90,23 +57,17 @@ export default function Banner() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
|
{/* Repeat the above structure for each slide-item as needed */}
|
||||||
{/* Slide 2 - Bottom to Top */}
|
<SwiperSlide className="slide-item">
|
||||||
<SwiperSlide>
|
|
||||||
<motion.div
|
|
||||||
className="slide-item"
|
|
||||||
initial="hidden"
|
|
||||||
animate={activeIndex === 1 ? "visible" : "hidden"}
|
|
||||||
variants={variants.bottomToTop}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className="bg-layer"
|
className="bg-layer"
|
||||||
style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-2.webp)' }}
|
style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-2.webp)' }}
|
||||||
></div>
|
></div>
|
||||||
|
{/* <figure className="image-layer"><img src="/assets/images/home/banner/banner-img-2.webp" alt="" /></figure> */}
|
||||||
<div className="auto-container">
|
<div className="auto-container">
|
||||||
<div className="content-box custom-content-box" style={{ background: 'white', borderRadius: '15%', opacity: 0.8 }}>
|
<div className="content-box custom-content-box" style={{ background: 'white', borderRadius: '15%', opacity: 0.8 }}>
|
||||||
|
|
||||||
<span className="upper-text">Compassionate Care, Delivered with Expertise</span>
|
<span className="upper-text">Compassionate Care, Delivered with Expertise</span>
|
||||||
<h2>Healing Touch, <span>Fresh</span> Inner Strength</h2>
|
<h2>Healing Touch, <span>Fresh</span> Inner Strength</h2>
|
||||||
<p>Expert Hand Massage Techniques for Relief</p>
|
<p>Expert Hand Massage Techniques for Relief</p>
|
||||||
@ -120,23 +81,17 @@ export default function Banner() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
|
|
||||||
{/* Slide 3 - Left to Right */}
|
{/* Repeat the above structure for each slide-item as needed */}
|
||||||
<SwiperSlide>
|
<SwiperSlide className="slide-item">
|
||||||
<motion.div
|
|
||||||
className="slide-item"
|
|
||||||
initial="hidden"
|
|
||||||
animate={activeIndex === 2 ? "visible" : "hidden"}
|
|
||||||
variants={variants.leftToRight}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className="bg-layer"
|
className="bg-layer"
|
||||||
style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-3.webp)' }}
|
style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-3.webp)' }}
|
||||||
></div>
|
></div>
|
||||||
<div className="auto-container">
|
<div className="auto-container">
|
||||||
<div className="content-box custom-content-box" style={{ background: 'white', borderRadius: '15%', opacity: 0.8 }}>
|
<div className="content-box custom-content-box" style={{ background: 'white', borderRadius: '15%', opacity: 0.8 }}>
|
||||||
|
|
||||||
<span className="upper-text">Your Path to Complete Wellness Starts Here</span>
|
<span className="upper-text">Your Path to Complete Wellness Starts Here</span>
|
||||||
<h2>Local Physio <span>Experts </span> Near You</h2>
|
<h2>Local Physio <span>Experts </span> Near You</h2>
|
||||||
<p>Physiotherapy Etobicoke & Rehab Care.</p>
|
<p>Physiotherapy Etobicoke & Rehab Care.</p>
|
||||||
@ -150,23 +105,17 @@ export default function Banner() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
|
|
||||||
{/* Slide 4 - Right to Left */}
|
<SwiperSlide className="slide-item">
|
||||||
<SwiperSlide>
|
|
||||||
<motion.div
|
|
||||||
className="slide-item"
|
|
||||||
initial="hidden"
|
|
||||||
animate={activeIndex === 3 ? "visible" : "hidden"}
|
|
||||||
variants={variants.rightToLeft}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className="bg-layer"
|
className="bg-layer"
|
||||||
style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-4.webp)' }}
|
style={{ backgroundImage: 'url(/assets/images/home/banner/home-banner-4.webp)' }}
|
||||||
></div>
|
></div>
|
||||||
|
{/* <figure className="image-layer"><img src="/assets/images/home/banner/banner-img-4.webp" alt="" /></figure> */}
|
||||||
<div className="auto-container">
|
<div className="auto-container">
|
||||||
<div className="content-box custom-content-box" style={{ background: 'white', borderRadius: '15%', opacity: 0.8 }}>
|
<div className="content-box custom-content-box" style={{ background: 'white', borderRadius: '15%', opacity: 0.8 }}>
|
||||||
|
|
||||||
<span className="upper-text">Healing Hands, Caring Hearts in Action</span>
|
<span className="upper-text">Healing Hands, Caring Hearts in Action</span>
|
||||||
<h2>Wellness <span>by the</span>Waterfront</h2>
|
<h2>Wellness <span>by the</span>Waterfront</h2>
|
||||||
<p>Waterfront Physio and Rehab Services.</p>
|
<p>Waterfront Physio and Rehab Services.</p>
|
||||||
@ -180,9 +129,10 @@ export default function Banner() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
|
|
||||||
</Swiper>
|
</Swiper>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user