rippleJS icon indicating copy to clipboard operation
rippleJS copied to clipboard

Add ability to define settings

Open atomiks opened this issue 7 years ago • 4 comments

Firstly, nice little library!

I'd like to define my own settings to modify the ripple. If you don't want users to use a constructor/call a factory, then perhaps use data-* attributes on the element you specify the rippleJS class name.

The main settings I'd like is

  • duration
  • ability to bind the event directly to the element. The problem with using event delegation is that sometimes you have inner elements which are the targets of the mousedown event but still want to trigger the ripple on the parent, so the ripple won't work.

atomiks avatar May 31 '17 14:05 atomiks

Thanks, glad you like it.

my 2c: data-duration sounds painful if a user has to set it on every element, but I'm loathe to have it as a global on window or something. So I'll think.

Your second ask—can you clarify, you mean you want a click on one element to trigger a ripple on another? (I can see cases where e.g., the inner thing has layout but you want an outer thing to ripple).

samthor avatar May 31 '17 23:05 samthor

Okay, cool

<div class="outer rippleJS">
    <span>text</span>
</div>

If I click the span element, I still want the ripple to be activated since it's a child of the outer element

atomiks avatar Jun 01 '17 14:06 atomiks

@atomiks I don't think this is an issue. The following should give you your desired effect.

<div class="outer">
    <span>text</span>
    <div class="rippleJS"></div>
</div>

cpamp avatar Jun 27 '17 23:06 cpamp

@atomiks For your first issue on params, I have a fork which adds 2 attributes for color and duration. I also added additional ways to identify elements that should ripple that is less confusing and verbose

<div class="bar square" ripplejs ripplejs-color="blue" ripplejs-duration="2000ms" ripplejs-fill>
  My Content
</div>

<div class="bar square">
    <span>Clickable</span>
    <div class="rippleJS" data-ripplejs-color="red" data-ripplejs-duration="1s" data-ripplejs-fill></div>
</div>

cpamp avatar Jun 28 '17 03:06 cpamp