Git Product home page Git Product logo

task1's Introduction

task1

Task 1: Create a Product Carousel for Featured Products I created a simple image carousel with navigation buttons to showcase featured chocolate products on a website homepage. Here's how I approached it: HTML Structure: I structured the HTML with a container for the carousel ( ) and individual slides ( ). Each slide contains an image of a chocolate product and optional text content. CSS Styling: I utilized CSS to style the carousel and slides, including their positioning, dimensions, and transitions for smooth animations. I also styled the navigation buttons (#prev and #next) to enhance their appearance. JavaScript Functionality: I employed JavaScript to select the navigation buttons (#prev and #next) and all the slides using querySelector and querySelectorAll. Initializing variables such as curSlide (current slide index) and maxSlide (maximum slide index). I utilized a forEach loop to horizontally translate each slide by multiplying its index with a fixed value (500 pixels). This positions the slides side by side within the carousel. Event listeners were added to the previous and next buttons. Upon clicking, these buttons increment or decrement the curSlide index accordingly. If the current slide is the first or last slide, the index loops back to the last or first slide, creating a continuous loop effect. Within the event listener functions, another forEach loop adjusts the translation of each slide based on the current slide index. This horizontally shifts the slides to simulate sliding. Responsive Design: I incorporated media queries to adjust the dimensions of the carousel and slides for different screen sizes. This ensures that the carousel remains functional and visually appealing across various devices. In summary, my approach efficiently implements a basic image carousel with manual navigation functionality using HTML, CSS, and vanilla JavaScript. It provides a straightforward solution for showcasing featured chocolate products on a website homepage while maintaining responsiveness and visual appeal.

task1's People

Contributors

surabhi-agnihotri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.