lundi 29 juin 2015

Target CSS transition at pseudo-element "Arrow"?

I have a DIV with an "arrow" at the bottom, not unlike a speech bubble from a comic book, which appears on the hover state:

enter image description here

The arrow is created with the :after and :before pseudo elements.

I have a transition for the hover for the border color and the box shadow.

My problem is that the "arrow" just "appears". No fade like the other items, but I can't figure out how to target the "arrow". "All" does not look right either.

Ideally, I'd love to have a delay on the arrow and a simple fade or wipe.

Here's the CSS:

.item-selector-button {
  position: relative;
  text-align: center;
  cursor: pointer;
  border: 1px solid #cecece;
  padding: 15px;
  border-radius: 0;
  color: #000;
  width: 160px;
  height: 120px;
  transition: all ease-in-out 0.1s, box-shadow ease-in-out 0.1s;
}

.item-selector-button .title {
  color: #3e53a4;
  font-size: 12px;
  margin: 0;
  padding-top: -3px;
  font-family: "PrecisionSans_W_Md", "Helvetica Neue", Arial, sans-serif;
}

.item-selector-button .divider {
  height: 1px;
  width: 20px;
  background-color: #cecece;
  margin: 4px auto 10px;
}

.item-selector-button .image {
  background: #fff url("../images/box.png") center center no-repeat;
  width: 64px;
  height: 57px;
  margin: 4px auto;
}

.item-selector-button:hover, .item-selector-button.hover {
  padding: 14px;
}

.item-selector-button:hover:after, .item-selector-button.hover:after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 68px;
  border-width: 12px 12px 0;
  border-style: solid;
  border-color: #fff transparent;
  transition-delay: 0.3s;
}

.item-selector-button:hover:before, .item-selector-button.hover:before {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 65px;
  border-width: 15px 15px 0;
  border-style: solid;
  border-color: #3e53a4 transparent;
  transition-delay: 0.3s;
}

.item-selector-button:active, .item-selector-button.active {
  border-width: 2px;
  border-color: #3e53a4;
  background-color: #3e53a4;
}

.item-selector-button:active:before, .item-selector-button.active:before {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 65px;
  border-width: 15px 15px 0;
  border-style: solid;
  border-color: #3e53a4 transparent;
  transition-delay: 0.3s;
}

.item-selector-button:active .title, .item-selector-button.active .title {
  color: #fff;
}

.item-selector-button:active .divider, .item-selector-button.active .divider {
  background-color: #fff;
}

.item-selector-button:active .image, .item-selector-button.active .image {
  background-color: #3e53a4;
}

.item-selector-button:active:hover, .item-selector-button.active:hover {
  padding: 15px;
  box-shadow: none;
}

.item-selector-button:active:hover:after, .item-selector-button.active:hover:after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 68px;
  border-width: 12px 12px 0;
  border-style: solid;
  border-color: #3e53a4 transparent;
  transition-delay: 0.3s;
}

.item-selector-button.disabled {
  pointer-events: none;
  cursor: not-allowed;
}

.item-selector-button.disabled .title {
  color: #c3c3c3;
}

.item-selector-button.disabled .image {
  background-image: url("../images/box-disabled.png");
}

.item-selector-button.disabled:hover {
  padding: 15px;
  border: 1px solid #cecece;
  box-shadow: none;
}

Aucun commentaire:

Enregistrer un commentaire