ven*_*lam 9 ajax jquery resize model
我使用过SimpleModal.现在的问题是调整模式对话框的大小.我有一个确认对话框,按下是后它基本上很小.
第二个是my.php,它包含大数据.我正在使用附加已有模型的概念.如何调整内容的大小?
我的JavaScript代码段包含:
$(document).ready(function () {
$('#confirmbutton, #confirmDialog a.confirm').click(function (e) {
e.preventDefault();
confirm("Continue to the SimpleModal project page?", function () {
window.location.href = 'http://localdata/';
});
});
});
function confirm(message, callback) {
$('#confirm').modal({
close:false,
position: ["20%",],
overlayId:'confirmModalOverlay',
containerId:'confirmModalContainer',
onShow: function (dialog) {
dialog.data.find('.message').append(message);
// If the user clicks "yes"
dialog.data.find('.yes').click(function () {
// Call the callback
// $.modal.close();
$.get("my.php", function (data) {
/* Sample response:
* <div id="title">My title</div>
* <div id="message">My message</div>
*
*/
var resp = $("<div/>").append(data);
var title = resp.find("#title").html(),
message = resp.find("#message").html();
dialog.data.find(".header span").html(title);
dialog.data.find(".message").html(message);
dialog.data.find(".buttons .yes").hide();
dialog.data.find(".buttons .no").hide();
//dialog.data.find(".buttons .no").html("Close");
// No need to call the callback or $.modal.close()
});// End for click
});//End for on show
} //End for modal
}); //Close for modal
}
Run Code Online (Sandbox Code Playgroud)
我的CSS:
confirmModalContainer {height:700px; width:700px; font-family:'Trebuchet MS', Verdana, Arial; font-size:16px; text-align:left; background:#fff; border:2px solid #336699;}
Run Code Online (Sandbox Code Playgroud)
如何修改SimpleModal容器大小?在Ajax电话上?
小智 11
这样做....
$("#simplemodal-container").css('height', 'auto'); //To reset the container.
$(window).trigger('resize.simplemodal'); //To refresh the modal dialog.
Run Code Online (Sandbox Code Playgroud)
您可以通过添加和删除 modalContainer 元素的类来完成此操作。
Fog Creek Copilot使用 SimpleModal,有普通和宽两种尺寸。如果您进入 Copilot 并单击“登录”,您将看到正常大小。现在,放入 Firebug 的控制台
>> $('.modalContainer').addClass('wide')
Run Code Online (Sandbox Code Playgroud)
您应该看到容器变宽。要在您的网站上实现此功能,您所要做的就是为您想要的所有尺寸定义类,并动态添加和删除它们。