2012-08-23 27 views
11

Próbowałem zintegrować modulator bootstrapu twitter, ale z jakiegoś powodu to nie działa.Twitter Bootstrap 2.1 - Modal nie działa poprawnie

Problem polega na tym, że modal jest wyświetlany po załadowaniu strony.

Napisałem to w moim <head>

<script type="text/javascript"> 
    $('#myModal').modal({show: false,keyboard: false}); 
    </script> 

Ale nie ma efektu.

Kod użyłem: (http://twitter.github.com/bootstrap/javascript.html#modals)

<-- Button to trigger modal --> 
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> 

<-- Modal --> 
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
    <div class="modal-header"> 
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
    <h3 id="myModalLabel">Modal header</h3> 
    </div> 
    <div class="modal-body"> 
    <p>One fine body…</p> 
    </div> 
    <div class="modal-footer"> 
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> 
    <button class="btn btn-primary">Save changes</button> 
    </div> 
</div> 

To sprawia, bezpośrednio po załadowaniu strony, gdybym ponownie nacisnąć przycisk modalne znika, i wydaje się, że 2 raz ale cała strona jest darkend (nawet sam modal jest zaciemniony)

Ktoś doświadczył tego samego problemu?

Pchnąłem to do heroku, abyś mógł zobaczyć problem. http://elobeast.com/ (prawy górny róg „Uruchom demo modalne”)

Odpowiedz

14

Trzeba dodać klasę .hide do głównego pojemnika swojej modalnym to ukryć, dopóki nie zostanie wywołana.

+0

Dzięki temu poprawiono :) –

Powiązane problemy