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

HSOverlay.on not working #393

Closed
pastc opened this issue Jun 16, 2024 · 3 comments
Closed

HSOverlay.on not working #393

pastc opened this issue Jun 16, 2024 · 3 comments

Comments

@pastc
Copy link

pastc commented Jun 16, 2024

Summary

The event listeners on the overlay is not working.

Using Vue3

Steps to Reproduce

import { HSOverlay } from 'preline'

onMounted(() => {
  const modalElement = document.querySelector('#hs-scan') as HTMLElement
  const modal = new HSOverlay(modalElement)

  console.log(modal)

  if (modal) {
    modal.on('open', () => {
      console.log('Modal opened')
      // modalIsOpen.value = true
      // console.log(modalIsOpen.value)
    })

    modal.on('close', () => {
      console.log('Modal closed')
      // modalIsOpen.value = false
      // console.log(modalIsOpen.value)
    })
  }
})

Expected Behavior

Should print the corresponding strings when opened and closed

Actual Behavior

Doesn't print anything

Screenshots

No response

@pastc
Copy link
Author

pastc commented Jun 17, 2024

I ended up using vueuse to check if its open.
https://vueuse.org/core/useElementVisibility/

@pastc pastc closed this as completed Jun 17, 2024
@Fed3x
Copy link

Fed3x commented Jun 20, 2024

Can you share your solution?

@pastc
Copy link
Author

pastc commented Jun 22, 2024

@Fed3x

I ended up using vueuse to check if its open. https://vueuse.org/core/useElementVisibility/

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