javascript - Bootstrap 模态可调整大小和可拖动
问题描述
我正在尝试将我的模态转换为可调整大小和可拖动的。我已经尝试过可能的解决方案,例如 jquery 的 .resizable 和 .draggable 函数。
我已经包括
<script src="https://rawgit.com/RickStrahl/jquery-resizable/master/src/jquery-resizable.js"></script>
对于可调整大小的功能和
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" type="text/javascript"></script>
用于可拖动功能。当我使用这两个 .js 脚本进行可拖动时,我的其他 datetimepicker 脚本停止工作
<link rel="stylesheet" href="https://rawgit.com/Eonasdan/bootstrap-datetimepicker/master/build/css/bootstrap-datetimepicker.min.css">
<script src="https://rawgit.com/Eonasdan/bootstrap-datetimepicker/master/build/js/bootstrap-datetimepicker.min.js"></script>.
此外,在那之后,我的模态也不能拖动或调整大小。
/* The Modal (background) */
.his_modal_style {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 5; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.his_modal_style-content {
background-color: #fefefe ;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 55%;
overflow: auto;
}
/* The Close2 Button */
.his_close {
color: #aaaaaa ;
float: right;
font-size: 28px;
font-weight: bold;
}
.his_close:hover,
.his_close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
<div id="his_modal" class="his_modal_style">
<div class="his_modal_style-content">
<span class="his_close">×</span>
/*Modal content*/
</div>
</div>
我试过了
$('.his_modal_style-content').draggable({
handle: ".modal-header"
});
$('#his_modal_style').draggable({
handle: ".modal-header"
});
和
$('.his_modal_style-content').resizable({
});
$('#his_modal_style').resizable({
});
我期望模态可以拖动和调整大小。
已包含的所有脚本的图像:
解决方案
推荐阅读
- flutter - 类型列表动态不是类型映射字符串动态的子类型
- jquery - CSP & Safari:因为 CSP 而拒绝加载,但设置了 CSP
- html - HTML - 嵌套表格格式不正确
- python - W0703: 捕获过于笼统的异常 Exception (broad-except)
- python - 使用 Pyxll 提取 excel 公式/vba 代码以便在 python 中重写
- react-native - 在本机反应中使用 Formik 进行 RadioGroup 验证
- websocket - Rails 5 ActionCable 接收未调用
- activeadmin - 仅自定义资源中的单个属性
- vegan - 针对空间数据绘制 Jaccard 索引(经纬度)
- python - Apply function to single row in order to highlight cells based on condition