1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

showPopover() にポジショニングアンカー要素を渡す

Last updated at Posted at 2025-05-16

popoverElement.showPopover({source: AnchorElement})とすると渡せるようです。たとえば:

See the Pen showPopover() にアンカー要素を渡す by lhankor_mhy (@lhankor_mhy) on CodePen.

最小の数値の下にポップオーバーを表示します。

document.querySelectorAll('input[type="number"]').forEach(input => {
    input.addEventListener('change', () => {
        const target = [...document.querySelectorAll('input[type="number"]')].reduce(
            (min, input) => Number(min.value) <= Number(input.value) ? min : input
        );
        document.querySelector('dialog').showPopover({ source: target });
    });
});
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?