Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Button Ripple Effect"
Bootstrap 4.1.1 Snippet by
saikiran053
4.1.1
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
6.9K
 
1 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html> <html lang="en"> <head> <title>Button Ripple Effect </title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> </head> <body class="index"> <div class="container-fluid margin"> <button href="https://www.behance.net/sakiran" target="_blank" class="themeBtn ripple-effect">Saikiran Netha's</button> </div> <div class="container-fluid margin"> <a class="themeBtn2 ripple-effect">Saikiran Netha's</a> </div> <div class="container-fluid margin"> <a href="https://dribbble.com/saikiran053" target="_blank" class="themeBtn3 ripple-effect">Follow @ Dribble</a> </div> <div class="container-fluid margin"> <a href="https://www.behance.net/sakiran" target="_blank" class="themeBtn4 ripple-effect">Follow @ Behance</a> </div> </body> </html>
.margin{ margin-top:20px; margin-bottom:20px; } .themeBtn { background: #ff5c00; color: #ffffff !important; display: inline-block; font-size: 15px; font-weight: 500; height: 50px; line-height: 0.8; padding: 18px 30px; text-transform: capitalize; border-radius: 1px; letter-spacing: 0.5px; border:0px !important; cursor:pointer; } a:hover{ color: #ffffff; text-decoration:none; } .themeBtn:hover { background: rgb(255, 92, 0); color: #ffffff; } .themeBtn2 { background: #7600ff; color: #ffffff !important; display: inline-block; font-size: 15px; font-weight: 500; height: 50px; line-height: 0.8; padding: 18px 30px; text-transform: capitalize; border-radius: 1px; letter-spacing: 0.5px; border:0px !important; cursor:pointer; } .themeBtn2:hover { background: rgb(118, 0, 255); color: #ffffff; } .themeBtn3 { background: #ff2e4d; color: #ffffff !important; display: inline-block; font-size: 15px; font-weight: 500; height: 50px; line-height: 0.8; padding: 18px 30px; text-transform: capitalize; border-radius: 1px; letter-spacing: 0.5px; border:0px !important; cursor:pointer; } .themeBtn3:hover { background: rgb(255, 46, 77); color: #ffffff; } .themeBtn4 { background: #006eff; color: #ffffff !important; display: inline-block; font-size: 15px; font-weight: 500; height: 50px; line-height: 0.8; padding: 18px 30px; text-transform: capitalize; border-radius: 1px; letter-spacing: 0.5px; border:0px !important; cursor:pointer; } .themeBtn4:hover { background: rgb(0, 110, 255); color: #ffffff; } .ripple-effect { position: relative; overflow: hidden; -webkit-transform: translate3d(0, 0, 0); } .ink { display: block; position: absolute; pointer-events: none; border-radius: 50%; -webkit-transform: scale(0); -moz-transform: scale(0); -ms-transform: scale(0); -o-transform: scale(0); transform: scale(0); background: #fff; opacity: 0.5; } .ink.animate { -webkit-animation: ripple .5s linear; -moz-animation: ripple .5s linear; -ms-animation: ripple .5s linear; -o-animation: ripple .5s linear; animation: ripple .5s linear; } @keyframes ripple { 100% { opacity: 0; transform: scale(2.5); } } @-webkit-keyframes ripple { 100% { opacity: 0; -webkit-transform: scale(2.5); transform: scale(2.5); } } @-moz-keyframes ripple { 100% { opacity: 0; -moz-transform: scale(2.5); transform: scale(2.5); } } @-ms-keyframes ripple { 100% { opacity: 0; -ms-transform: scale(2.5); transform: scale(2.5); } } @-o-keyframes ripple { 100% { opacity: 0; -o-transform: scale(2.5); transform: scale(2.5); } }
/* ======================================================= Ripple-effect animation ======================================================= */ (function($) { $(".ripple-effect").click(function(e){ var rippler = $(this); // create .ink element if it doesn't exist if(rippler.find(".ink").length == 0) { rippler.append("<span class='ink'></span>"); } 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"); }) })(jQuery);
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76