Skip to content Skip to sidebar Skip to footer

The Animation Does Not Work When I Hover Around The Border

When I hover over the border, the animation does not render The original code pen link is as shown below https://codepen.io/anon/pen/GVvxqq i need the product class css to remain

Solution 1:

I have fixed it. something wrong with template tag i have removed it and worked.

.button {
  background: none;
  border: 0;
  box-sizing: border-box;
  margin: 1em;
  padding: 1em 2em;
  box-shadow: inset 0 0 0 2px #f45e61;
  color: #f45e61;
  font-size: inherit;
  font-weight: 700;
  position: relative;
  vertical-align: middle;
}
img{width:100%}
.button::before, .button::after {
  box-sizing: inherit;
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
}
.draw {
  transition: color 0.25s;
}
.draw::before, .draw::after {
  border: 2px solid transparent;
  width: 0;
  height: 0;
}
.draw::before {
  top: 0;
  left: 0;
}
.draw::after {
  bottom: 0;
  right: 0;
}
.draw:hover::before, .draw:hover::after {
  width: 100%;
  height: 100%;
}
.draw:hover::before {
  border-top-color: #60daaa;
  border-right-color: #60daaa;
  transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
.draw:hover::after {
  border-bottom-color: #60daaa;
  border-left-color: #60daaa;
  transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
  <div class="item button draw">
    <b-link @click="productDetail(item.productId)">
      <div class="product">
        <a class="img-prod">
          <img
            class="img-fluid product-image"
            :src="https://colorlib.com/wp/wp-content/uploads/sites/2/store-free-template.jpg"
            alt="Product Item"
          />
          <spanclass="status">test OFF</span>
        </a>

        <div class="text pt-3 px-3">
          <h3>test</h3>
          <div class="d-flex">
            <div class="pricing">
              <p v-if="item.discounts.length != 0" class="price">
                <span class="mr-2 price-dc">$5423</span>
                <span class="price-sale">$5345</span>
              </p>
              <p v-else class="price">
                <span>$435345</span>
              </p>
            </div>
          </div>
        </div>
      </div>
    </b-link>
  </div>

Solution 2:

You need to wrap the entire block in <section class="buttons"> and change the outermost <div> to <button> if you want to use the CSS as-is from the codepen. I have tested this and it works as expected.

<template>
    <section class="buttons">
        <button class="item button draw">
            <b-link @click="productDetail(item.productId)">
                //
                // custom element content
                //
            </b-link>
        </button>
    </section>
</template>

Post a Comment for "The Animation Does Not Work When I Hover Around The Border"