Jump to content

How in tailwindcss make modal dialog when page has horizontal scrolling?


Recommended Posts

Basing on tailwindcss 2 modal example https://alpinetoolbox.com/examples/modal
I make modal dialog with setting max-h-screen class, like

<div class="overflow-auto" role="dialog" style="background-color: rgba(0,0,0,0.5)" x-show="showModal"
:class="{ 'absolute inset-0 z-50 flex items-center justify-center': showModal }"
@keydown.escape.window="showModal = false"
class="flex flex-col sm:h-4/5 md:h-4/6 max-h-screen justify-between rounded shadow-lg py-4 text-left px-6 modal-container"
x-show="showModal" @click.away="showModal = false" x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 scale-90" x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="ease-in duration-300" x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-90">

and it works ok, untill page has no horizontal scrolling.

If page has horizontal scrolling - then only part of the page is with modal and space below is
empty and this makes page

I also tried to use max-h-full instead of max-h-screen, but no effect.

How can I made it ?


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.