Skip to content

Popover on hover Vue #2224

Answered by taythebot
prpanto asked this question in Help
Discussion options

You must be logged in to vote

Here's an example using mouseover and mouseleave events on the PopoverButton and PopoverPanel.

  • Event mouseover on PopoverButton, uses event.target.click() to open popover panel and sets popoverHover = true
  • Event mouseleave on PopoverButton sets popoverHover = false and starts a 100 millisecond delay. Afterwards it checks if popoverHover === false before using close prop to close the popover
  • If your mouse hovers inside PopverPanel before the 100 millisecond delay, it sets popoverHoever = true cancelling the close

You can adjust the delay to your liking. I found 100 milliseconds to be a good match for me.

If you have multiple popovers on your page, consider putting the below into a compon…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by prpanto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants