<style>

/* Reset */

* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: 'Segoe UI', Roboto, sans-serif; }


.card-container {

  display: flex;

  justify-content: center;

  padding: 30px 15px;

}


/* Main Card */

.dance-card {

  position: relative;

  width: 100%;

  max-width: 420px;

  background: #fff;

  border-radius: 18px;

  box-shadow: 0 12px 30px rgba(0,0,0,0.15);

  overflow: hidden;

  border: 1px solid #ddd;

  transition: 0.4s ease;

}


/* Card Content */

.dance-card img {

  width: 100%;

  height: auto;

  display: block;

  cursor: pointer;

  filter: brightness(1.05);

}

.dance-card h3 {

  text-align: center;

  font-size: 22px;

  font-weight: 700;

  color: #003300;

  margin: 20px;

  cursor: pointer;

}


/* Fake Arms/Legs for Animation */

.arm, .leg {

  width: 30px;

  height: 30px;

  background-color: #66bb66;

  border-radius: 50%;

  position: absolute;

  opacity: 0;

  z-index: 9;

}


/* Position of limbs */

.arm.left { top: 30%; left: -20px; }

.arm.right { top: 30%; right: -20px; }

.leg.left { bottom: -20px; left: 30%; }

.leg.right { bottom: -20px; right: 30%; }


/* View Button */

.view-danger {

  display: block;

  width: fit-content;

  margin: 20px auto 30px;

  padding: 12px 36px;

  background: linear-gradient(135deg, #00b300, #005500);

  color: white;

  font-weight: bold;

  font-size: 16px;

  text-decoration: none;

  border-radius: 30px;

  pointer-events: none;

}


/* Animation */

@keyframes thumka {

  0%, 100% { transform: rotate(0deg); }

  25% { transform: rotate(10deg); }

  50% { transform: rotate(-10deg); }

  75% { transform: rotate(8deg); }

}

@keyframes popout {

  0% { opacity: 0; transform: scale(0); }

  50% { opacity: 1; transform: scale(1.4); }

  100% { opacity: 0; transform: scale(0); }

}

.dance-card.dancing {

  animation: thumka 0.6s ease-in-out 2;

}

.dancing .arm, .dancing .leg {

  animation: popout 0.6s ease-in-out;

}

</style>


<!-- HTML Card -->

<div class="card-container">

  <div class="dance-card" id="itemCard">

    <!-- Arms & Legs -->

    <div class="arm left"></div>

    <div class="arm right"></div>

    <div class="leg left"></div>

    <div class="leg right"></div>


    <!-- Image and Title -->

    <img src="https://ehunar.org/uploads/thumbnails/course_thumbnails/course_thumbnail_default_1.webp" alt="Course Image" onclick="startItemDance()">

    <h3 onclick="startItemDance()">Machine Learning, AI & Data Science</h3>


    <!-- Button (style only) -->

    <a href="#" class="view-danger">View Details</a>

  </div>

</div>


<!-- JavaScript Dance Trigger -->

<script>

function startItemDance() {

  var card = document.getElementById("itemCard");

  card.classList.add("dancing");


  // Remove class after animation

  setTimeout(function() {

    card.classList.remove("dancing");

  }, 1200);

}

</script>


Comments

Popular posts from this blog