简体   繁体   中英

How prevent change popper placement with scroll?

I want to fix the popper element's position and not change the placement with later updates (without disabling the scroll listener).

The gif shows you my sticky popper, but I want it to be static. (don't change position on scroll):

在此处输入图像描述

Popper uses some modifiers that are not customizable, Instead, I use a new library whose name is Floating UI (the evolution of Popper 2).

Floating UI extended modifiers to something new as middleware. One of them whose name is shift can be or not be in the middleware list to handle shifting popper elements in the exiting from viewport situation.

You can find further information at Floating UI doc .

shift() moves the floating element along the specified axes in order to keep it in view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM