drublic / css-modal

A modal built with pure CSS, enhanced with JavaScript
https://drublic.github.io/css-modal
MIT License
1.82k stars 211 forks source link

Question: modal height when using more than one div and JS #201

Open duenni opened 9 years ago

duenni commented 9 years ago

Hi there,

thanks for this nice project! I'm using css-modals together with canvasjs and with more than one div. Code looks like this:

    <section class="modal--show" id="modal-text" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true">
        <div class="modal-inner">
            <header id="modal-label"><!-- Header -->My label</header>
            <div class="modal-content"><!-- The modals content -->
                <div id="chartContainer" style="height: 300px; width: 100%;"></div>
                <div id="stats"></div>
            </div>
        </div>
        <a href="#!" class="modal-close" title="Close this modal" data-close="Close" data-dismiss="modal">?</a>
    </section>

The <div>'s get their data from some JavaScript functions. Everything is fine except the height of the modal. It has scrollbars and won't adapt to the height of the generated content. How can I get the modal to fit to the content? Thanks in advance!