daisyui icon indicating copy to clipboard operation
daisyui copied to clipboard

Activate using class name instead of checkbox isn't at official website

Open Ross249 opened this issue 3 years ago โ€ข 2 comments

click here

Ross249 avatar Jul 03 '22 15:07 Ross249

problem with the listener

imtheaman avatar Jul 04 '22 05:07 imtheaman

if you change the opacity of .swap-on and .swap-off, it'll work. i think better way is to use onclick listener, but you can do so with css as well. i'm just not sure how to check onclick with css.

imtheaman avatar Jul 05 '22 04:07 imtheaman

I don't see any issues.
Look at the code example here:

<label class="swap text-6xl">
  <div class="swap-on">๐Ÿฅต</div>
  <div class="swap-off">๐Ÿฅถ</div>
</label>
<label class="swap swap-active text-6xl">
  <div class="swap-on">๐Ÿฅณ</div>
  <div class="swap-off">๐Ÿ˜ญ</div>
</label>

And you can see, as expected, the emoji with swap-on class is only visible when the parent has swap-active class.
This is an alternative way for when you don't want to use checkbox and you want to add/remove class name using JS.

Let me know if you have any questions.

saadeghi avatar Aug 12 '22 23:08 saadeghi