Skip to content

sabbir-web-dev/Expanding-Cards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

It seems like you've provided an HTML document along with JavaScript and CSS code for implementing expanding cards. However, it appears there's an issue with the placement of your JavaScript code within the HTML file. Your JavaScript code should be placed before the closing </body> tag to ensure that the elements it references are already loaded in the DOM.

Here's the corrected structure for your HTML file:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Expanding Cards</title>
  <link rel="stylesheet" href="/style.css">
</head>
<body>
  <div class="container">
    <div class="content active" style="background-image: url(Images/photo1.jpg)">
      <h3>Forest Bridge</h3>
    </div>
    <!-- Add other content divs here -->
  </div>
  <script src="/index.js"></script>
</body>
</html>

Ensure that your JavaScript code is placed in the index.js file and that it looks like this:

const contents = document.querySelectorAll(".content");

contents.forEach((content) => {
  content.addEventListener("click", () => {
    removeActive();
    content.classList.add("active");
  });
});

const removeActive = () => {
  contents.forEach((content) => {
    content.classList.remove("active");
  });
};

Also, it seems you've requested assistance in writing a README file for explaining the expanding cards project in detail. Here's a template for that:


Expanding Cards Project

This project aims to create a user interface featuring expanding cards. When a card is clicked, it expands to reveal more content, creating an interactive and visually appealing experience.

Table of Contents

Features

  • Interactive Cards: Clicking on a card expands it to reveal additional content.
  • Responsive Design: The interface is responsive and adjusts to different screen sizes.
  • Customizable: Easily customize the content and styling of the cards to fit various themes.

Installation

To use this project, follow these steps:

  1. Clone the repository:

    git clone <repository-url>
  2. Navigate to the project directory:

    cd expanding-cards
  3. Open the index.html file in your web browser.

Usage

Simply click on any card to expand it and reveal more content. The cards will smoothly transition to their expanded state, providing a visually engaging experience.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.


Feel free to customize this README according to your project's specific details and requirements.