javascript css ripple effect button

How we can create a ripple click effect like an android lollipop using HTML CSS JS? Solution: See this JavaScript CSS Ripple Effect Button Like Android, Button Click Effect.

Previously I have shared many button related programs, but this is a button click effect which is like the Android L ripple effect. Basically, the ripple effect is a situation in which, like ripples expanding across the water when an object is dropped into it. And the first time it introduced with the Android 5.0 Lollipop version. In the same way when you will click on the button, then the click effect will expand like that.

Today you will learn to create Button Click Effect like android lollipop material design. Basically, there are 4 buttons with different colors but all have the same effect. 4 Buttons for showing how the effect looks like in different colors. The best fact of these buttons is where you will click on the button, the effect will start from there.

So, Today I am sharing JavaScript CSS Ripple Effect Button Like Android. For creating this program I have used JavaScript and CSS, there JS is to detect the click place and start the animation from there. This program will best practice or tutorial for the guys who are a beginner in web development. You also can use this button click effect on your website to give a good UI.

If you are thinking now how this button click effect actually is, then see the preview given below.

Preview Of Button Click Effect

See this video preview to getting an idea of how this button click ripple effect looks like.

Live Demo

Now you can see this visually, you also can see it live by pressing the button given above. If you like this, then get the source code of its.

You May Also Like:

JavaScript CSS Ripple Effect Button Like Android Source Code

Before sharing source code, let’s talk about it. First, I have created a main div and placed a heading and 4 buttons inside it. HTML has very little part in this program, and also I have linked external files like JS, CSS, and font in the HTML file. I have created the buttons by simply using HTML <button> tag and put a text inside it.

Now using CSS I have placed all the elements in the right place, as you can see in the preview. I gave different colors for different buttons using CSS :nth-child() property (info). And for creating the ripple effect, I gave a black background with low opacity and 100% border-radius for the circle shape. After that, I have created an animation using @keyframe and expand the are of the shape using transform: scale() command. For used transition delay for giving the final touch.

JavaScript handling here one of the main features of this program. JS detects the click, I mean where you have clicked on the button and starts the animation from the same place. After detecting the click JS changing the CSS values to start the effect. Left all other things you will understand after getting the codes, I can’t explain all in writing.

For creating this program you have to create 3 files for that. First for HTML second for CSS, and the third for JavaScript. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

function.js

The final step, create a JavaScript file named ‘function.js‘ and put the codes.

That’s It. Now you have successfully created JavaScript CSS Ripple Effect Button Like Android, Button Click Effect. If you have any doubt or questions comment down below.

Thanks For Visiting, Keep Visiting.

1 COMMENT

  1. the animation is working but the problem is the animation is “playing” on another place (imagine there is 2 button, button A & B, the ripple applied on button A but not on button B, but the animation is playing/showing on button B).
    what’d i do wrong?

LEAVE A REPLY

Please enter your comment!
Please enter your name here