Skip to main content

How to Create a Image Slider Using HTML, CSS and JS

 

#html #css #foryou #world #happy # website #webdesign #webdeveloper #how to #howto #trending #viral #srilanka #youtube #tiktok #blog  #howtocreate #Javascript #image #imageuploader #imageslider #howtocreateimageslider 




🎥 Ready to level up your web development skills? Join us in this tutorial where we guide you through the process of creating a dynamic Image Slider using HTML, CSS, and JavaScript! 🚀 Explore the magic of coding as we break down each step, empowering both beginners and seasoned developers to enhance their projects with a stunning image carousel. From seamless transitions to customizable features, this tutorial covers it all. Elevate your website's visual appeal and engage your audience with an eye-catching image slider. Let's bring your designs to life! 💻🌟

Don't forget to like, share, and subscribe for more web development tutorials and tips. If you have any questions or need further assistance, feel free to leave a comment, and we'll be happy to help you out. Happy coding! 


index.html  
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image Slider</title>
    <link rel="stylesheet" href="style.css">
    <script src="https://kit.fontawesome.com/b186863b7d.js"
    crossorigin="anonymous"></script>
</head>
<body>
 <div class="container">
    <div class="slide">
        <div class="item" style="background-image: url(Image/Adam\'s\ peak\ \ sripadaya.jpg);">
            <div class="content">
                <div class="name">Siripadaya | Adam's Peak</div>
                <div class="des">Description Here....</div>
                <button>Read More...</button>
            </div>
        </div>

        <div class="item" style="background-image: url(Image/dunhinda\ ella.jpg);">
            <div class="content">
                <div class="name">Dunhinda Ella</div>
                <div class="des">Description Here....</div>
                <button>Read More...</button>
            </div>
        </div>

        <div class="item" style="background-image: url(Image/lotus-tower.jpg);">
            <div class="content">
                <div class="name">Lotus Tower</div>
                <div class="des">Description Here....</div>
                <button>Read More...</button>
            </div>
        </div>


        <div class="item" style="background-image: url(Image/nilaveli\ beach.jpg);">
            <div class="content">
                <div class="name">Nilaveli Beach</div>
                <div class="des">Description Here....</div>
                <button>Read More...</button>
            </div>
        </div>


        <div class="item" style="background-image: url(Image/ruwanweli\ maha\ seya.jpg);">
            <div class="content">
                <div class="name">Ruwanweli Maha Seya</div>
                <div class="des">Description Here....</div>
                <button>Read More...</button>
            </div>
        </div>


        <div class="item" style="background-image: url(Image/sigiriya.png);">
            <div class="content">
                <div class="name">Sigiriya</div>
                <div class="des">Description Here....</div>
                <button>Read More...</button>
            </div>
        </div>


        <div class="item" style="background-image: url(Image/Temple\ of\ the\ tooth\ relic.jpg);">
            <div class="content">
                <div class="name"></div>
                <div class="des"></div>
                <button>Read More...</button>
            </div>
        </div>





    </div>

    <div class="button">
        <button class="previous"><i class="fa-solid fa-arrow-left"></i></button>
        <button class="next"><i class="fa-solid fa-arrow-right"></i></button>
    </div>
 </div>
<script src="script.js"></script>
</body>
</html>


style.css  

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body{
    background: #fff;
}
.container{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1000px;
    height: 550px;
    box-shadow: 0 30px 45px black;
}
.container .slide .item{
    width: 200px;
    height: 300px;
    position: absolute;
    top: 50%;
    transform: translate(0, -50%);
    box-shadow: 0 30px 45px gray;
    background-position: 50% 50%;
    background-size: cover;
    display: inline-block;
    transition: 0.5s;
    border-radius: 15px;
}
.slide .item:nth-child(1), .slide .item:nth-child(2){
    top: 0;
    left: 0;
    transform: translate(0,0);
    border-radius: 8px;
    width: 100%;
    height: 100%;

}
.slide .item:nth-child(3){
    left: 50%;
}
.slide .item:nth-child(4){
    left: calc(50% + 220px);
}
.slide .item:nth-child(5){
    left: calc(50% + 440px);
}
.slide .item:nth-child(n +6){
    left: calc(50% + 660px);
    opacity: 0;
}

.item .content{
    position: absolute;
    top: 50%;
    left: 100px;
    width: 300px;
    text-align: left;
    color: #fff;
    transform: translate(0, -50%);
    font-family: Georgia, 'Times New Roman', Times, serif;
    display: none;
}
.slide .item:nth-child(2) .content{
    display: block;
}
.content .name{
    font-size: 35px;
    text-transform: uppercase;
    font-weight: bold;
    opacity: 0;
    animation: animate 1s ease-in-out 1 forwards;
}
.content .des{
    margin-top: 10px;
    margin-bottom: 20px;
    opacity: 0;
    animation: animate 1s ease-in-out 0.3s 1 forwards;
}
.content button{
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    animation: animate 1s ease-in-out 0.6s 1 forwards;
}
@keyframes animate {
    from{
        opacity: 0;
        transform: translate(0, 100px);
        filter: blur(30px);
    }
    to{
        opacity: 1;
        transform: translate(0);
        filter: blur(0);
    }
}
.button{
    width: 100%;
    text-align: center;
    position: absolute;
    bottom: 20px;
}
.button button{
    margin: 0 5px ;
    border: 1px solid #000;
    transition: 0.2s;
    width: 40px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    border-radius: 3px;
}  
.button button:hover{
    background: gray;
    color: black;
}





script.js 

let next = document.querySelector('.next')
let previous = document.querySelector('.previous')
next.addEventListener('click', function(){
    let items = document.querySelectorAll('.item')
    document.querySelector('.slide').appendChild(items[0])
})
previous.addEventListener('click', function(){
    let items = document.querySelectorAll('.item')
    document.querySelector('.slide').prepend(items[items.length - 1])
})









































Comments

Popular posts from this blog

Parallax Scrolling Website Effect Using HTML CSS

  Welcome to our step-by-step tutorial on creating Parallax Scrolling Website Effect using #html  & #css  . In this video, we'll guide you through the process of building a simple yet effective Parallax Effect for your web projects. With just a few lines of code, you'll learn how to create a user-friendly interface that allows users to this effect seamlessly. Whether you're a beginner or an experienced developer looking to enhance your skills, this tutorial is perfect for you. Follow along and empower yourself to create dynamic web applications with ease! Don't forget to like, share, and subscribe for more coding tutorials. Let's get started! index.html  <! DOCTYPE html > < html lang = "en" >   < head >     < meta charset = "UTF-8" />     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" />     < title > Parallax Scrolling Website </ title >     ...

Build a Simple Calculator Using HTML, CSS and JavaScript | Step-by-Step Tutorial

    You'll learn how to create a fully functional calculator using #html #css and #javascript . Follow along as we break down the process into easy-to-understand steps, from designing the user interface with HTML and CSS to adding interactive functionality with JavaScript. 🔹 Learn the fundamentals of HTML, CSS, and JavaScript. 🔹 Design a sleek and user-friendly calculator interface. 🔹 Implement basic arithmetic operations, including addition, subtraction, multiplication, and division. 🔹 Handle user input and display results in real-time. 🔹 Enhance the calculator with clear functionality. 🔹 Perfect for web development beginners and anyone looking to sharpen their skills. By the end of this tutorial, you'll have your very own #calculator that you can showcase in your web development portfolio. index.html <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport...

How to Create Animate Mic Logo

    Embark on a design and coding adventure with our tutorial on creating and animating a microphone logo using HTML and CSS. In this concise yet comprehensive guide, we'll navigate logo design principles, emphasizing simplicity and visual balance. Seamlessly transitioning to animation, we'll bring the mic logo to life, making it dynamic and engaging. What sets this tutorial apart is its accessibility—no complex software, just the power of code.🎙️✨ #logoanimation #designtutorial #webdevelopment Don't forget to like, share, and subscribe for more web development tutorials and tips. If you have any questions or need further assistance, feel free to leave a comment, and we'll be happy to help you out. Happy coding! Like Us On Facebook:    / codingwithnexusofficial   Follow Us On Instagram:    / coding_with_nexus   Follow Us On TikTok:    / coding.with.nexus  index.html <! DOCTYPE html > < ...