Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap modal only showing backdrop

EDIT: I've found the issue. Turns out the person who originally made this page missed a closing <div> tag on modal s/he had created, so the content of my modal was hidden inside the original.

My bootstrap modal is not showing the dialog box, instead only showing the darkened backdrop. I have the following Modal set up in the footer of my page.

<div id="timePopup" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" style='border-radius:0px;width:430px;margin-left:-215px'>
    <div class="modal-body">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="position: absolute; top: 3px; right: 7px; z-index: 9999;">&times;</button>
        <div class="modal-body" style='border: black solid 2px;margin: 5px;'>
            <?php echo $popup_content; ?>
        </div>
    </div>
</div>

$popup_content just contains the simple string 'Test test test test'. It is triggered by an onclick attribute in a <span> which call this function

function forcePopUp(){
    jQuery('#timePopup').modal('show');
}

The exact same code worked on our development server, but since moving it to the testserver this has started happening, or not happening i suppose.

From another post on SO I tried removing the .hide class from the modal, and have ensured this modal has a unique id. Any other ideas why would be appreciated.

like image 582
James Avatar asked Apr 30 '14 09:04

James


People also ask

What is backdrop in Bootstrap modal?

The backdrop option specifies whether the modal should have a dark overlay (the background color of the current page) or not. Modal with Overlay (backdrop:true) Modal without Overlay (backdrop:false) Modal with backdrop:"static" ×

How do I get rid of modal backdrop fade in CSS?

remove(); $('. modal-backdrop'). remove(); $('body'). removeClass( "modal-open" );

How do I show a Bootstrap modal inside a div?

To show a bootstrap modal inside a div the logic behind the above code is to append the HTML code of the modal as well as the modal-backdrop inside that specific div(blue div whose position is relative) and then making the CSS for modal and modal-backdrop to position:absolute so that the modal and its background gets ...


1 Answers

If the modal html is rendered into a hidden area of the page, it won't display either

like image 135
pscheit Avatar answered Sep 19 '22 23:09

pscheit