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

Class tools clasess event #83

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

n4j1Br4ch1D
Copy link

@n4j1Br4ch1D n4j1Br4ch1D commented Aug 18, 2024

On event trigger class manipulation

This feature allows for dynamic class manipulation in response to specific events using the classes-event-trigger or data-classes-event-trigger attribute.

<!-- The following performs class manipulation only after the event is triggered -->
<div hx-ext="class-tools">
    <div classes="add foo:1s" classes-event-trigger="my-custom-event">Class foo wil be added after 1s</div> <!-- Adds the class "foo" 1 second after the event is triggered -->
    <div classes="toggle foo:!" classes-event-trigger="my-custom-event">Class foo wil be toggled</div> <!-- "!" means toggle immediately with no delay -->
    <div classes="toggle foo:!, toggle bar:!" classes-event-trigger="my-custom-event">Class foo & bar wil be toggled</div> <!-- toggles multiple classes -->
    <button hx-on-click="htmx.trigger('body', 'my-custom-event')">toggle</button>
</div>

Copy link

netlify bot commented Aug 18, 2024

Deploy Preview for htmx-extensions ready!

Name Link
🔨 Latest commit 28ab422
🔍 Latest deploy log https://app.netlify.com/sites/htmx-extensions/deploys/66c202ab7f12df000818085b
😎 Deploy Preview https://deploy-preview-83--htmx-extensions.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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

Successfully merging this pull request may close these issues.

1 participant