Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing with a custom class/id #91

Closed
rockers123 opened this issue Feb 16, 2015 · 7 comments
Closed

Initializing with a custom class/id #91

rockers123 opened this issue Feb 16, 2015 · 7 comments
Milestone

Comments

@rockers123
Copy link

Is it possible to initialize the plugin with a custom class? something like,

Waves.displayEffect('.my-custom-class');

Thanks

@hoxxep
Copy link
Contributor

hoxxep commented Feb 16, 2015

What would the class be attached to? If you can describe what you're trying to do with Waves that requires this extra class, then I'll understand what you mean - and why - a little better? 😄

@rockers123
Copy link
Author

Sorry, for the unclear question.

I want to use waves effects on buttons in an existing project where I got buttons everywhere(around 100). Assigning the .wave-effect class to each and every buttons manually would cost me alot of time. It would make my life easier if I can directly attach the waves on 'button' elements.

@fians
Copy link
Owner

fians commented Feb 17, 2015

I think it will be a nice idea. Actually, feature like that already added by @hoxxep (see it here), but it still really simple implementation and only accept DOM element as parameter.

I will extend Waves.attach() to make it more flexible to use. But for now, you can call Waves.displayEffect() first then attach waves-effect class using javascript/jquery to your existing class element.

Example:

// vanilla javascript
var elements = document.getElementByClass('your-custom-class');
for (var a = 0; a < elements.length; a++) {
    elements[a].className += ' waves-effect';
}

// jQuery
$('.your-custom-class').addClass('waves-effect');

@rockers123
Copy link
Author

Thank you very much for the awesome plugin and support. I think this will do the job

@fians fians added this to the v0.7.0 milestone Mar 4, 2015
@hoxxep
Copy link
Contributor

hoxxep commented Apr 11, 2015

In pull request #108 I've upgraded the Waves.attach(elements, classes) function to allow you to use a string selector to apply the .waves-effect and any optional waves classes dynamically. Hopefully that helps!

@fians
Copy link
Owner

fians commented Apr 13, 2015

I just made a little changes to Waves.attach(). The function now will use array of classes string as parameter instead string of classes. It's just to improve code readability, just in case someone want to add more than 3 classes to Waves elements.

@fians
Copy link
Owner

fians commented Apr 14, 2015

Ok. It seems this feature is done. It will be shipped on v0.7.0

@fians fians closed this as completed Apr 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants