2012-05-28 3 views
7

모달 데이터 닫기/닫기 동작을 클릭하여 모달을 닫으려고합니다. 내가 찾을 수없는 문제가있는 것으로 보이며 여기 누군가가 문제를 밝힐 수 있기를 바랍니다. 여기에 코드Twitter Bootstrap 모달 데이터 삭제

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset='UTF-8'/> 
    <title> Modal test </title> 
    <link href='themes/default/bootstrap/css/bootstrap.css' rel='stylesheet'/> 
    <link href='themes/default/bootstrap/css/bootstrap-responsive.css'  rel="stylesheet"/> 
</head> 
<body> 
<div class="modal" id="myModal"> 
    <div class="modal-header"> 
    <button class="close" data-dismiss="modal">×</button> 
    <h3>Modal header</h3> 
    </div> 
    <div class="modal-body"> 
    <p>One fine body…</p> 
    </div> 
    <div class="modal-footer"> 
    <a href="#" class="btn">Close</a> 
    <a href="#" class="btn btn-primary">Save changes</a> 
    </div> 
</div> 
<div class="alert alert-block"> 
    <a class="close" data-dismiss="alert" href="#">x</a> 
    <h4 class="alert-heading">Warning!</h4> 
    Best check yo self, you're not... 
</div> 

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
<script src="themes/default/bootstrap/js/bootstrap.js"></script> 
</body> 
</html> 

내가 작업을 시험하기위한 <div class="alert alert-block">에 넣어 부트 스트랩 - modal.js

을 포함한 부트 스트랩의 전체 제품군이있다, 경고에 작동하는 것 같다하지만 모달! .

<script type="text/javascript"> 
    $(document).ready(function() { 
     $('#myModal').modal(); // initialized with defaults 
     $('#myModal').modal('show'); // open your modal dialog 
    }); 
</script> 
+1

전화를 걸고있는 $ ("# myModal") 모달 ('쇼') 함수를 : –

답변

2

이 코드를하시기 바랍니다 추가? 당신의 예제와 함께 일하는 바이올린이 있습니다 : http://jsfiddle.net/tPv7u/
+1

'Show'는 기본적으로 설정되어 있으므로, 두 개의 #myModal 라인은 똑같이해야합니다. – Dirk