How to keep Bootstrap 4 dropdowns in the viewport

How to keep Bootstrap 4 dropdowns in the viewport

george.levinesgeorge.levines Posts: 11Questions: 4Answers: 0

Is there a way to keep Bootstrap 4 buttons from spilling out of the viewport? Even the ones in the example seem to do it but in BS4's documentation, button menus automagically stay in view.

Answers

  • colincolin Posts: 5,448Questions: 0Answers: 943

    Hi @george.levines ,

    Can you give more details on what's spilling out please, and what you think it should be doing instead? That link you posted looks fine to me.

    Cheers,

    Colin

  • george.levinesgeorge.levines Posts: 11Questions: 4Answers: 0

    In other words, I would expect this menu to open to the top if the div extended beyond the viewport to the bottom.

  • allanallan Posts: 49,749Questions: 1Answers: 7,345 Site admin

    It does do correction for the document, but it doesn't take a div into account. That would require parsing up the DOM and could be quite slow.

    Allan

  • george.levinesgeorge.levines Posts: 11Questions: 4Answers: 0

    So in other words, this is expected?

    I guess it's just in contrast to the examples given here https://getbootstrap.com/docs/4.3/components/dropdowns/

  • allanallan Posts: 49,749Questions: 1Answers: 7,345 Site admin

    Correct - Buttons doesn't 100% implement the Bootstrap extras there. It primarily just uses Bootstrap for styling, but because it isn't solely a Bootstrap component, it doesn't have support (yet) for all the extra classes Bootstrap makes available.

    Allan

Sign In or Register to comment.