bootstrap模态框去掉遮罩层

本文介绍了一种使用CSS技巧让模态框背景透明的方法,通过设置.opacity属性实现完全透明效果,适用于需要优化用户体验的设计场景。
.modal-backdrop {
 	 opacity: 0 !important;
 	 filter: alpha(opacity=0) !important;
}

去掉之前:

去掉之后:

<div id="device_modal" class="modal fade" style="display: none;"> <div class="modal-content"> <span class="close">×</span> <p>这里是model演示</p> <table id="device_table"> <!-- 设备数据将在这里动态加载 --> </table> </div> </div> {#<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">#} {#<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>#} {#<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>#} <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> <script> $(document).ready(function() { let newIndex = 1; // 工单行计数器 // 添加工单行 $('#button_processedorder').click(function() { $('#processedorder tbody').append(` <tr data-id="${newIndex}"> <td>${newIndex}</td> <td><input type="text" class="process_order" required></td> <td><input type="text" class="name" required></td> <td><input type="text" class="figure_number" required></td> <td><input type="number" min="1" max="20000" class="count" required></td> <td><input type="date" class="due_date" required></td> <td><input type="number" min="1" max="20000" class="figure_count" required></td> <td><input type="text" class="item_number" required></td> </tr> `); newIndex++; }); // 选择设备按钮 $('#button_device').click(function() { $.get('/project/get_devices/', function(response) { let html = ''; alert('11111111111111'); if (response && response.devices) { // 添加空值检查 $.each(response.devices, function(i, device) { html += `<tr> <td>${device.id}</td> <td>${device.name}</td> <td>${device.serial}</td> <td><button class="select-device" data-id="${device.id}">选择</button></td> </tr>`; }); alert(html) $('#device_table').html(html); $('#device_modal').modal('show'); alert('33333333333'); } else { console.error('设备数据格式错误:', response); } }); 其中的<div id="device_modal" class="modal fade" style="display: none;">组件无法显示,页面变成暗色 Django
最新发布
09-30
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值