[英]How i can add a close button and resize the jQuery modal
I have the following jQuery modal code:-我有以下 jQuery 模态代码:-
<script>
$(document).ready(function () {
$(function () {
$.ajaxSetup({ cache: false });
//$("a[data-modal]").on("click", function (e) {
$(document).on('click', 'a[data-modal]', function (e) {
$('#myModalContent').css({ "max-height": screen.height * .82, "overflow-y": "auto" }).load(this.href, function () {
$('#myModal').modal({
height: 1000,
width: 2200,
resizable: true,
keyboard: true,
backdrop: 'static',
draggable: true
}, 'show');
});
return false;
});
});
$(function () {
$(document).on('click', 'a[data-dismiss]', function (e) {
if ($(this).attr('data-reload') == 'no') {
$(this).parents('.modal').first().modal('hide');
}
});
});
});
</script>
and the following HTML to show the modal:-和以下 HTML 显示模态:-
<div id='myModal' class='modal fade in'>
<div class="modal-dialog">
<div class="modal-content">
<div id='myModalContent'></div>
</div>
</div>
</div>
<a data-modal='' href="/home/bookappointment" title="Detail"> Book Appointment </a>
but currently the modal will only occupy a very small part of the screen + i can not close the modal popup.但目前模态只会占据屏幕的很小一部分+我无法关闭模态弹出窗口。 so can anyone advice how i can expand the modal height and width + add a close button to it?
那么任何人都可以建议我如何扩展模态高度和宽度+为其添加关闭按钮吗?
You can use data-dismiss="modal" like this.您可以像这样使用 data-dismiss="modal" 。
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.