cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <!--
	If u want to use in your project
	the only things to do is to add:
	data-animation="ripple" 
	in the elements you want ;)
-->

<div class="container">
	<a data-animation="ripple">Click Me</a>
</div>
            
          
!
            
              :root {
	/* if u want to change the color of
	 * the ripple change this value
	*/
	--color-ripple: rgba(255,255,255,0.8);
}

body {
	background: #36353c;
}

.container {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	height: 50px;
	width: 200px;
	margin: auto;
}
*[data-animation="ripple"] {
	position: relative; /*Position relative is required*/
	height: 100%;
	width: 100%;
	display: block;
	outline: none;
	padding: 20px;
	color: #fff;
	text-transform: uppercase;
	background: linear-gradient(135deg, #e570e7 0%,#79f1fc 100%);
	box-sizing: border-box;
	text-align: center;
	line-height: 14px;
	font-family: roboto, helvetica;
	font-weight: 200;
	letter-spacing: 1px;
	text-decoration: none;
	box-shadow: 0 5px 3px rgba(0, 0, 0, 0.3);
	cursor: pointer;
  /*border-radius: 50px;*/
	-webkit-tap-highlight-color: transparent;
}

*[data-animation="ripple"]:focus {
	outline: none;
}

*[data-animation="ripple"]::selection {
	background: transparent;
	pointer-events: none;
}
            
          
!
            
              /*
 * If u want integrate that, i've create a library for use ripple in your
 * beautifoul projects 🤙
 *
 * Here the link:
 * https://github.com/tomma5o/touchMyRipple
 */

const isMobile = window.navigator.userAgent.match(/Mobile/) && window.navigator.userAgent.match(/Mobile/)[0] === "Mobile";
const event = isMobile ? "touchstart" : "click";

const button = document.querySelectorAll('*[data-animation="ripple"]'),
			container = document.querySelector(".container");

for (var i = 0; i < button.length; i++) {
	const currentBtn = button[i];
	
	currentBtn.addEventListener(event, function(e) {
		
		e.preventDefault();
		const button = e.target,
					rect = button.getBoundingClientRect(),
					originalBtn = this,
					btnHeight = rect.height,
					btnWidth = rect.width;
		let posMouseX = 0,
				posMouseY = 0;
		
		if (isMobile) {
			posMouseX = e.changedTouches[0].pageX - rect.left;
			posMouseY = e.changedTouches[0].pageY - rect.top;
		} else {
			posMouseX = e.x - rect.left;
			posMouseY = e.y - rect.top;
		}
		
		const baseCSS =  `position: absolute;
											width: ${btnWidth * 2}px;
											height: ${btnWidth * 2}px;
											transition: all linear 700ms;
											transition-timing-function:cubic-bezier(0.250, 0.460, 0.450, 0.940);
											border-radius: 50%;
											background: var(--color-ripple);
											top:${posMouseY - btnWidth}px;
											left:${posMouseX - btnWidth}px;
											pointer-events: none;
											transform:scale(0)`
		
		var rippleEffect = document.createElement("span");
		rippleEffect.style.cssText = baseCSS;
		
		//prepare the dom
		currentBtn.style.overflow = "hidden";
		this.appendChild(rippleEffect);
		
		//start animation
		setTimeout( function() { 
			rippleEffect.style.cssText = baseCSS + `transform:scale(1); opacity: 0;`;
		}, 5);
		
		setTimeout( function() {
			rippleEffect.remove();
			//window.location.href = currentBtn.href;
		},700);
	})
}

            
          
!
999px
Loading ..................

Console