cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              body {
  background: #fff;
}

.clicky {
    position: relative;
    width: 310px;
    cursor: pointer;
    background: #E8EAF6;
    top: 20px;
    position: relative;
    font-family: arial;
    margin: 0 auto;
    text-align: center;
    padding: 20px 0;
    box-shadow: 0px 0px 20px -3px #5C6BC0;
}
            
          
!
            
              $.fn.yarp = function(options) {
    var options = options || {};

    this.options = {
        colors: ['gray'],       // Array. Colors to be used randomly
        duration: 750           // Integer. Duration of the ripple animation
    };

    this.options = $.extend({}, this.options, options);

    $(this).each(function(i, e) {

        // No overflow for the selected set of elements
        $(e).css({
            overflow: 'hidden'
        });

        $(e).on('click', function(ev) {
            // Create the ripple element
            var ripple = $('<div></div>').appendTo($(e));

            // Set some initial CSS
            ripple.css({
                width: 1,
                height: 1,
                borderRadius: '50%',
                opacity: 1,
                background: this.options.colors[Math.floor(Math.random() * this.options.colors.length) + 0],
                top: ev.clientY - ($(e).offset().top - $(window).scrollTop()),
                left: ev.clientX - ($(e).offset().left - $(window).scrollLeft()),
                position: 'absolute'
            });

            // Additional CSS to be set at the end of the browser's execution queue
            setTimeout(function() {
                ripple.css({
                    transform: 'scale(1000)',
                    opacity: 0,
                    transition: 'all ' + this.options.duration + 'ms linear'
                });
            }.bind(this), 0);

            // Remove ripple after it finished animating
            setTimeout(function() {
                ripple.remove();
            }, this.options.duration);

        }.bind(this));
    }.bind(this));
};

$('.clicky').yarp({
  colors: ['#5C6BC0'],
  duration: 750
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console