Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

<div class="material-ripple" data-ripple-color="#1BB">Text</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Montserrat);

body {
  margin: 20px 0 0;
  background: #F5F5F5;
  font-family: 'Montserrat', sans-serif;
}

/* Material Ripple effect */
.material-ripple {
	position: relative;
	overflow: hidden;
	cursor: pointer;
	user-select: none;
  
  text-align: center;
  background: #FFF;
  width: 200px;
  height: 200px;
  margin: auto;
  line-height: 200px;
}
/*
*/
.material-ink {
  position: absolute;
	background: #bdc3c7;
	border-radius: 50%;
	transform: scale(0);
	opacity: 0.4;
}
.material-ink.animate {
	animation: ripple 0.6s linear;
}
@keyframes ripple {
	100% {
		transform: scale(2.5);
		opacity: 0;
	}
}
              
            
!

JS

              
                // Material Ripple effect
$(".material-ripple").click(function(event) {
	var surface = $(this);

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

	var ink = surface.find(".material-ink");

	// in case of quick double clicks stop the previous animation
	ink.removeClass("animate");

	// set size of .ink
	if (!ink.height() && !ink.width()) {
		// use surface's width or height whichever is larger for
		// the diameter to make a circle which can cover the entire element
		var diameter = Math.max(surface.outerWidth(), surface.outerHeight());
		ink.css({height: diameter, width: diameter});
	}

	// get click coordinates
	// Logic:
	// click coordinates relative to page minus
	// surface's position relative to page minus
	// half of self height/width to make it controllable from the center
	var xPos = event.pageX - surface.offset().left - (ink.width() / 2);
	var yPos = event.pageY - surface.offset().top - (ink.height() / 2);

	var rippleColor = surface.data("ripple-color");

	//set the position and add class .animate
	ink.css({
		top: yPos + 'px',
		left: xPos + 'px',
		background: rippleColor
	}).addClass("animate");
});
              
            
!
999px

Console