Within my web app, I have implemented dynamically generated Bootstrap 5 dropdown menus that can sometimes be extensive. To optimize screen space usage, I am seeking a way to alter the offset computed by Popper.js through javascript. Unfortunately, I have encountered challenges in achieving this as the Popper.js documentation lacks clarity on this matter, and there are no resources on how to accomplish this within Bootstrap 5. (The data-bs-offset attribute is not suitable as it does not support dynamic offset values through a function).
You can review the code example on JSFiddle at https://jsfiddle.net/Martin_ATS/cqw5mjLv/3/. While I am able to access the Dropdown object using bootstrap.Dropdown.getInstance() and jQuery $(ddelem).dropdown(), altering the offset through javascript has proved to be challenging, despite attempts to utilize setOptions() and similar methods.
My aim is to leverage the computed y offset from Bootstrap/Popper, while adjusting the x offset to align the menu closer to the left margin and creating a right margin instead of being flush against the right window edge. The provided code snippet is a simplified example, with the actual dropdown menu contents varying from small to extensive, possibly requiring horizontal or vertical scrolling.
Any assistance on this matter would be greatly appreciated!