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

allow multiple css class triggers on element #73

Closed
jrevillini opened this issue Jul 21, 2019 · 4 comments
Closed

allow multiple css class triggers on element #73

jrevillini opened this issue Jul 21, 2019 · 4 comments

Comments

@jrevillini
Copy link

Description

Describe the solution you'd like
I'd like to be able to add multiple classes to a button which trigger ocs events. For example, if I have 2 slidebars with ids x and y, I'd like to have a button that closes x and opens y like so:
<button class='ocs-close-x ocs-open-y'>open y, close x</button>
or maybe close both x and y
<button class='ocs-close-x ocs-close-y'>close all</button>

Is your feature request related to a problem? Please describe.
No, it'd just be a nice-to-have.

Other notes

When I add two of such classes, it will attach the trigger based on the first ocs-{action}-{id} class, but it ignored the others.

Describe alternatives you've considered
I can use the JS API to do it ...

@JoryHogeveen
Copy link
Owner

Hi @jrevillini,

Sounds like a good feature! Not sure how/if I would do this for shortcodes but the included JS should definitely support this.
Currently I'm on holiday but I'll surely take a look at this when I return.
Also feel free to make a pull request if you are able!

Thanks, Jory

@jrevillini
Copy link
Author

Sure, happy to work on it! I have a feeling the current JS stops after it finds the first action-class on something. I'll see what I can do. Enjoy your holiday!

@JoryHogeveen
Copy link
Owner

JoryHogeveen commented Jul 30, 2019

Hi @jrevillini

Been looking at this a bit more.
Thing is that the Slidebars library only allows one sidebar to be opened at a time. (See #62)

So multiple triggers won't make any sense. If you open a sidebar the JS will auto close the other open sidebar if there is one. In other words, all triggers fire but they won't do anything.

For example, if I have 2 slidebars with ids x and y, I'd like to have a button that closes x and opens y

This would be the same as adding a trigger that just opens y and x would be auto closed.

For closing all sidebars you can use: ocs-close--all.

@JoryHogeveen
Copy link
Owner

Closing this issue in favor of #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants