title: clipboard animation on click
body: <p>In the <code>CSS</code> I have a <code>:focus</code> <code>animation</code> that you can see is only running when I <em>click and hold</em> the box. How do I get it to run when the <code>.active</code> class is added on click?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
    $(".copy-btn").click(function(event) {
      event.preventDefault();
    });
  });
  $('.close1, .close2').on('click', function() {
    $('.copy-btn').removeClass('active');
  })
  var clip = new Clipboard(".copy-btn");
  $(".copy-btn").click(function(e) {
    $.each($(".copy-btn"), function(index, value) {
      if (
        $(value).attr("data-clipboard-text") ==
        $(e.target).attr("data-clipboard-text")
      ) {
        $(value).addClass("active");
      }
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.btn {
    width: 50px;
    height: 20px;
    cursor: pointer;
  }
  
  .copy-btn {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    max-height: 125px;
    max-width: 75%;
    margin-right: auto;
    margin-left: auto;
    padding: 15px 5px;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    border: 1px dashed silver;
    color: #54c48a;
    cursor: pointer;
  }
  
  .active {
    border: 3px solid;
    color: silver;
  }
  
  @keyframes copy-btn-animation {
    0% {
      transform: translateY(0rem);
      opacity: 1;
    }
    99% {
      transform: translateY(-1.5rem);
      opacity: 0;
    }
    100% {
      transform: translateY(0rem);
    }
  }
  
  .copy-btn:before {
    position: absolute;
    content: "Copied!";
    opacity: 0;
  }
  
  .copy-btn:focus:before {
    animation-name: copy-btn-animation;
    animation-duration: 1s;
    animation-timing-function: ease;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.12/clipboard.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;a href="#" class="copy-btn" data-clipboard-text="CODE1"&gt;CODE1&lt;/a&gt;
  &lt;a href="#" class="copy-btn" data-clipboard-text="CODE2"&gt;CODE2&lt;/a&gt;
  &lt;div class="btn close1"&gt;reset&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>