Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                // TODO add trigger to btn 2

// * INSPIRED BY PHIL HOYT *

.title
  h1 Call to Action Experiment
  .separator

.container
  .btn.btn1.ripple-effect
    .text Call to Action
    .icon.fa.fa-arrow-right

  .btn.btn2.ripple-effect
    .text Call to Action
    .icon.fa.fa-arrow-right
    
.side-note A pen by 
  a(href='https://www.codepen.io/guywald' target='_blank') Guy Waldman
              
            
!

CSS

              
                // import Roboto Font
@import "https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic&subset=latin,cyrillic"

$bgColor: lighten(#DFECE6,20%)
$accentColor1: #3CA2A2
$accentColor2: #215A6D
$accentColor3: #2D2D29
// -----
$btnWidth: 130px
$btnHeight: 30px

body
  font-family: 'Roboto', sans-serif
  background-color: $bgColor
  display: flex
  flex-direction: column
  align-items: center
  justify-content: space-around
  
// ------------------------

.side-note
  position: absolute
  left: 10px
  top: 10px
  font-weight: 300
  font-size: .7em
  color: #888
  a
    cursor: default
    text-decoration: underline
    color: inherit
    font-weight: 500
    transition: color 300ms ease
    &:hover
      color: #555
  

.container
  height: 75vh
  display: flex
  flex-direction: column
  align-items: center
  justify-content: center
  
  
.title
  margin-top: $btnHeight
  height: 15vh
  display: flex
  justify-content: center
  align-items: center
  flex-direction: column
  text-align: center
  h1
    color: $accentColor3
    font-weight: 500
    font-size: 2em
    margin: 5px
  h2
    margin: $btnHeight/2
    margin-top: 0
    color: lighten($accentColor3, 20%)
    font-weight: 300
    font-size: 1em
  .separator
    display: block
    background-color: lighten($accentColor3, 20%)
    margin: $btnHeight/2
    height: 1px
    width: $btnWidth/2
  
.btn
  position: relative
  margin: $btnHeight/2
  user-select: none
  cursor: default
  display: block
  text-align: center
  border: 1px solid $accentColor1
  width: $btnWidth
  height: $btnHeight
  border-radius: 5px
  padding: 10px 25px
  box-shadow: 0 0 5px 0 rgba($accentColor1,.15)
  line-height: $btnHeight
  .text, .icon
    font-size: .7em
    text-align: center
    text-transform: uppercase
    color: $accentColor1
    font-weight: 500
  
// --------------------------------------

.btn.btn1
  border-color: $accentColor1
  box-shadow: 0 0 5px 0 rgba($accentColor1,.15)
  .text, .icon
    color: $accentColor1
  transition: all 300ms ease
  overflow: hidden
  .ink
    background: $accentColor1
  .text
    position: relative
    bottom: 0
    opacity: 1
    transition: all 300ms ease
  .icon
    position: relative
    opacity: 0
    bottom: 0
    transition: all 300ms ease
    &.clicked
      animation: growAndShrink 300ms ease-in-out
  &:hover
    background-color: rgba($accentColor1,.1)
    .text
      bottom: $btnHeight
      opacity: 0
    .icon
      opacity: 1
      bottom: $btnHeight


.btn.btn2
  white-space: nowrap
  border-color: $accentColor2
  box-shadow: 0 0 5px 0 rgba($accentColor2,.15)
  .text, .icon
    transition: all 300ms ease
    color: $accentColor2
  transition: all 300ms ease
  overflow: hidden
  // animation: myFrames 300ms ease-out reverse forwards
  .ink
    background: $accentColor2
  .text
    position: relative
    left: 0
    opacity: 1
  .icon
    position: relative
    transform: rotate(60deg)
    bottom: $btnHeight
    right: $btnWidth
    opacity: 0
  &:hover
    background-color: rgba($accentColor2,.1)
    .text
      left: $btnWidth
      opacity: 0
    .icon
      transform: rotate(0)
      right: 0
      opacity: 1
        
@keyframes growAndShrink
  0%
    transform: scale(1)
  50%
    transform: scale(1.3)
  100%
    transform: scale(1)

// ------------ RIPPLE EFFECT ---------------

.ripple-effect
  position: relative
  overflow: hidden
  transform: translatez(0)

.ripple-effect .ink
  display: block
  position: absolute
  pointer-events: none
  border-radius: 50%
  transform: scale(0)
  background: $accentColor1
  opacity: .2
  &.animate
    animation: ripple-effect 0.5s linear

@keyframes ripple-effect
  100%
    opacity: 0
    transform: scale(2.5)
              
            
!

JS

              
                // adds "clicked" class to icon when button is clicked
$(".btn").each(function(){
  $(this).click(function(event) {
    console.log("clicked");
    var icon = $(this).find(".icon");
    icon.removeClass("clicked").width(); // forces reflow of element
    icon.addClass("clicked");
  });
});



// ----------- RIPPLE EFFECT ------------

/**
 * Created by Kupletsky Sergey on 04.09.14.
 *
 * Ripple-effect animation
 * Tested and working in: ?IE9+, Chrome (Mobile + Desktop), ?Safari, ?Opera, ?Firefox.
 * JQuery plugin add .ink span in element with class .ripple-effect
 * Animation work on CSS3 by add/remove class .animate to .ink span
 */

$(".ripple-effect").each(function(){
  $(this).click(function(e) {
    var rippler = $(this);

    // create .ink element if it doesn't exist
    if (rippler.find(".ink").length == 0) {
      rippler.prepend("<div class='ink'></div>");
    }

    var ink = rippler.find(".ink");

    // prevent quick double clicks
    ink.removeClass("animate");

    // set .ink diametr
    if (!ink.height() && !ink.width()) {
      var d = Math.max(rippler.outerWidth(), rippler.outerHeight());
      ink.css({
        height: d,
        width: d
      });
    }

    // get click coordinates
    var x = e.pageX - rippler.offset().left - ink.width() / 2;
    var y = e.pageY - rippler.offset().top - ink.height() / 2;

    // set .ink position and add class .animate
    ink.css({
      top: y + 'px',
      left: x + 'px'
    }).addClass("animate");
  })
});
              
            
!
999px

Console