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

Auto Save

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

              
                <div class="heading text-center">RippleCator
  <div class="small">google material inspired</div>
</div>

<h2>Can be any tag</h2>
<a data-ripplecator class='ripple-btn dark-ripples' href='#'><span>a tag</span></a>
<button data-ripplecator type="button" class="ripple-btn dark-ripples"><span>type=&quot;button&quot;</span></button>
<button data-ripplecator class='ripple-btn dark-ripples' type='reset'><span>type=&quot;reset&quot;</span></button>
<button data-ripplecator class='ripple-btn dark-ripples' type='submit'><span>type=&quot;submit&quot;</span></button>

<h2>Can be any color</h2>
<button data-ripplecator class='ripple-btn dark-ripples' type='button'><span>Default</span></button>
<button data-ripplecator class='ripple-btn btn-blue blue-ripples' type='button'><span>Primary</span></button>
<button data-ripplecator class='ripple-btn btn-orange orange-ripples' type='button'><span>Warning</span></button>
<button data-ripplecator class='ripple-btn btn-red red-ripples' type='button'><span>Error</span></button>
<button data-ripplecator class='ripple-btn btn-green green-ripples' type='button'><span>Success</span></button>

<h2>Can be a group of elements</h2>
<div class='ripple-btn-group'>
  <button data-ripplecator class='ripple-btn dark-ripples' type='button'><span>Left item</span></button>
  <button data-ripplecator class='ripple-btn dark-ripples' type='button'><span>Middle item</span></button>
  <button data-ripplecator class='ripple-btn dark-ripples' type='button'><span>Right item</span></button>
</div>
              
            
!

CSS

              
                

/* general colors */
@base:#60605b;
@tone:#a7b0b2;
@white:white;
@black:black;


/* buttons */

@names: btn-green btn-red btn-blue btn-orange btn-pink btn-gray btn-darkblue btn-purple;
@colors: #5ca934 #d5452f #1097e6 #f4902a #e8367f #47494f #3b5ca0 #9966cb;


/* ripples */
@dark_ripple_alpha:20;
@dark_ripple_color:#333;

@light_ripple_alpha:20;
@light_ripple_color:#eceff1;

@red_ripple_alpha:70;
@red_ripple_color:#b0120a;

@blue_ripple_alpha:70;
@blue_ripple_color:#01579b;

@green_ripple_alpha:70;
@green_ripple_color:#056f00;

@orange_ripple_alpha:70;
@orange_ripple_color:#e65100;



/* Ripple gradient - you could use your own */
.gradient-vertical(@solid, @alpha) {
	background-image:radial-gradient(ellipse at center, fade(@solid,@alpha) 0%,fade(@solid,0) 5%,fade(@solid,@alpha) 6%,fade(@solid,@alpha) 10%,fade(@solid,0) 11%,fade(@solid,0) 15%,fade(@solid,@alpha) 16%,fade(@solid,@alpha) 20%,fade(@solid,0) 21%,fade(@solid,0) 25%,fade(@solid,@alpha) 26%,fade(@solid,@alpha) 30%,fade(@solid,0) 31%,fade(@solid,0) 34%,fade(@solid,@alpha) 35%,fade(@solid,0) 100%);
}



/* base css */
html {
	height:100%;
}
body {
	font-family: 'Roboto Condensed', sans-serif;
	height:100%;
	font-size:14px;
	background-color:lighten(@tone,30%);
	background-image:linear-gradient(#d7e1eb,#bbc3ce);
	color:darken(@base,15%);
	margin:20px;
	text-align:center;
}
.heading {
	margin:15px 0 35px 0;
	font-size:56px;
	font-weight: 400;
  
  .small{
    font-size:18px;
  }
}
h2{
	margin:35px 0 15px 0;
	font-size:24px;
	font-weight: 400;  
}
/* ==================================== BUTTONS ====================================*/

/* generator */
.ripple-btn{
  position: relative;
  display: inline-block;
	box-sizing:border-box;
  font:14px 'Roboto Condensed';
	outline:none;	
	overflow:hidden;
  vertical-align: middle;
  height: 34px;
  line-height: 34px;
  padding: 0 20px;
  color: #555;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
	background-origin: border-box;
  border: 1px solid fade(black, 25);
  border-radius:4px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
	background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
	span{
		position:relative;
		z-index:3;
	}
  &:hover:before { background:radial-gradient(farthest-corner, fade(white, 18), fade(white, 3)); }
  &:active { box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); }
}


.do-buttons(@varCount) when (@varCount > 0){
  @bname: extract(@names,@varCount);
  @bcolor: extract(@colors,@varCount);
  .@{bname}{
		color:contrast(@bcolor);
    background: @bcolor;
		text-shadow: 0 1px 1px fade(darken(@bcolor,20), 75);
    border-color: darken(@bcolor, 10%) darken(@bcolor, 10%) darken(@bcolor, 20);
    background-image: linear-gradient(to bottom, lighten(@bcolor, 6), darken(@bcolor, 6));

    &:active {
      background: @bcolor;
      border-color: darken(@bcolor, 15%) darken(@bcolor, 10%) darken(@bcolor, 10%);
    }
  }
  .do-buttons(@varCount - 1);
}

/* loop through @names-n-@colors */
.do-buttons(length(@names));



/* groups */
.ripple-btn-group {
    display: inline-block;
    vertical-align: middle;
    position: relative;
    font-size: 0.001px;
    white-space: nowrap;
	&  > * { display: inline-block; font-size:14px;}
	& > .ripple-btn:not(:first-child):not(:last-child),
	& > div:not(:first-child):not(:last-child) .ripple-btn { border-radius: 0; }
	
	& > .ripple-btn:first-child,
	& > div:first-child .ripple-btn {
		border-top-right-radius: 0;
		border-bottom-right-radius: 0;
	}
	
	& > .ripple-btn:last-child,
	& > div:last-child .ripple-btn {
		border-top-left-radius: 0;
		border-bottom-left-radius: 0;
	}
	& > .ripple-btn:nth-child(n+2),
	& > div:nth-child(n+2) .ripple-btn{
		margin-left: -1px; 
	}

	&:after {
		content:"";
		display:block;
		height:0;
		clear:both;
	}
}


/* ripple element styling */
.circle {
  position: absolute;
	z-index:2;
	transform-origin:center center;
  width: 130px;
  height: 130px;
	transform: scale(0.2);
  border-radius: 50%;
  animation: scale-circle 2.5s;
  animation-fill-mode:forward;
}



/* ripple element color styling */
.dark-ripples > .circle{
	.gradient-vertical(@dark_ripple_color, @dark_ripple_alpha);

}

.light-ripples > .circle{
	.gradient-vertical(@light_ripple_color, @light_ripple_alpha);
}

.blue-ripples > .circle{
	.gradient-vertical(@blue_ripple_color, @blue_ripple_alpha);
}

.red-ripples > .circle{
	.gradient-vertical(@red_ripple_color, @red_ripple_alpha);
}

.green-ripples > .circle{
	.gradient-vertical(@green_ripple_color, @green_ripple_alpha);
}

.orange-ripples > .circle{
	.gradient-vertical(@orange_ripple_color, @orange_ripple_alpha);
}

@keyframes scale-circle {
    0 {
      transform: scale(0.2);
      opacity: 0.4;
    }
    70% {
      transform: scale(2.5);
      opacity: 0;
    }
  100% {
      transform: scale(2);
      opacity: 0;
    }
}
              
            
!

JS

              
                (function(window, $) {

  $(function() {

    $('[data-ripplecator]').on('click', function(event) {

      var $div = $('<div/>'),
        btnOffset = $(this).offset(),
        xPos = event.pageX - btnOffset.left,
        yPos = event.pageY - btnOffset.top;

      $div
        .addClass('circle')
        .css({
          top: yPos - 65,
          left: xPos - 65
        })
        .appendTo($(this));

      window.setTimeout(function() {
        $div.remove();
      }, 1500);
      event.preventDefault();
    });

  });

})(window, jQuery);
              
            
!
999px

Console