![](/img/trans.png)
[英]How can I add a close button to the Modal Box (Lightbox) Typo3 extension?
[英]How i can add a close button and resize the jQuery modal
我有以下 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>
和以下 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>
但目前模態只會占據屏幕的很小一部分+我無法關閉模態彈出窗口。 那么任何人都可以建議我如何擴展模態高度和寬度+為其添加關閉按鈕嗎?
您可以像這樣使用 data-dismiss="modal" 。
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.