用bootstrap结合jQuery实现简单的模态对话框
    		       		warning:
    		            这篇文章距离上次修改已过454天,其中的内容可能已经有所变动。
    		        
        		                
                
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Bootstrap Modal Example</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
 
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal">打开模态框</button>
 
<div id="myModal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <!-- 内容区 -->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">×</button>
                <h4 class="modal-title">模态标题</h4>
            </div>
            <div class="modal-body">
                <p>这里是模态内容...</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
 
</body>
</html>这段代码展示了如何使用Bootstrap和jQuery创建一个简单的模态对话框。用户点击按钮后,会触发模态框的打开,模态框包括标题、内容区和关闭按钮。
评论已关闭