我目前在我的 Web 应用程序上使用 Block UI 模态插件 (http://www.malsup.com/jquery/block/)。
生成模态框需要输入一些 jQuery。我只是想知道我是否以最快的方式这样做。谁能建议一种更快的方法来输入下面的代码,因为我觉得我有点重复?
$(document).ready(function () {
/*=======================================
MODAL WINDOW
=======================================*/
// register window
$('#register').click(function () {
$.blockUI({
message: $('#register_win'),
css: {
width: '500px'
}
});
});
$('#register_close').click(function () {
$.unblockUI();
return false;
});
// about window
$('#about').click(function () {
$.blockUI({
message: $('#about_win'),
css: {
width: '500px'
}
});
});
$('#about_close').click(function () {
$.unblockUI();
return false;
});
// privacy window
$('#privacy').click(function () {
$.blockUI({
message: $('#privacy_win'),
css: {
width: '500px'
}
});
});
$('#privacy_close').click(function () {
$.unblockUI();
return false;
});
// terms window
$('#terms').click(function () {
$.blockUI({
message: $('#terms_win'),
css: {
width: '500px'
}
});
});
$('#terms_close').click(function () {
$.unblockUI();
return false;
});
// language window
$('#language').click(function () {
$.blockUI({
message: $('#language_win'),
css: {
width: '500px'
}
});
});
$('#language_close').click(function () {
$.unblockUI();
return false;
});
// forgot password window
$('#forgotpwd').click(function () {
$.blockUI({
message: $('#forgotpwd_win'),
css: {
width: '500px'
}
});
});
$('#forgotpwd_close').click(function () {
$.unblockUI();
return false;
});
});