Skip to content

Instantly share code, notes, and snippets.

@techhahn
Created July 13, 2016 10:19
Show Gist options
  • Select an option

  • Save techhahn/567686402be9d5c073b2f8c726d1286b to your computer and use it in GitHub Desktop.

Select an option

Save techhahn/567686402be9d5c073b2f8c726d1286b to your computer and use it in GitHub Desktop.
var ripple = $("<div class='ripple'>");
var offsetX = e.pageX - $(this).offset().left;
var offsetY = e.pageY - $(this).offset().top;
var size = .8 * ($(this).width() > $(this).height() ? $(this).width() : $(this).height());
ripple.css({left:offsetX, top:offsetY, height:size, width:size});
ripple.one("webkitAnimationEnd oanimationend msAnimationEnd animationend",function(){$(this).remove()});
$(this).prepend(ripple);
@include keyframes(ripple) {
0% {
@include transform(translateX(-50%) translateY(-50%) scale(1));
}
80% {
@include transform(translateX(-50%) translateY(-50%) scale(3));
}
100% {
@include transform(translateX(-50%) translateY(-50%) scale(3));
opacity: 0;
}
}
.has-ripple {
position: relative;
overflow: hidden;
@include transition(.4s all);
}
.ripple {
background: #FFF;
position: absolute;
-webkit-animation: ripple 1s cubic-bezier(0.23, 1, 0.32, 1);
animation: ripple 1s cubic-bezier(0.23, 1, 0.32, 1);
border-radius: 50%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
pointer-events: none;
z-index: 3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment