Make children hover effect trigger on parents hover #3661
-
QuestionI want to scale the image to 110 on hover as the code below shows. with ui.element(parent):
ui.image(child.jpg).classes('hover:scale-110')
ui.element(child) |
Beta Was this translation helpful? Give feedback.
Answered by
marcuslimdw
Sep 2, 2024
Replies: 2 comments 2 replies
-
with ui.element().classes('w-32 h-32 bg-green border') as ele:
ele2 = ui.element().classes('w-16 h-16 bg-red border hover:scale-150 ')
ele.on('mouseenter',lambda :ele2.classes(add='scale-150'))
ele.on('mouseout',lambda :ele2.classes(remove='scale-150')) |
Beta Was this translation helpful? Give feedback.
0 replies
-
use the Tailwind with ui.element(parent).classes("group"):
ui.image("child.jpg").classes("group-hover:scale-110") |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
afusdev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use the Tailwind
group
utility (from https://tailwindcss.com/docs/hover-focus-and-other-states#styling-based-on-parent-state):