CreateTemplate, OpenTemplate 및 기타 많은 Jquery 대화 상자 설정은 대부분 동일한 시간 설정을 사용하지만 높이와 너비에 대한 예외가 있습니다.jquery 대화 상자에 속성 배열 전달
모든 키/값 설정이있는 배열의 jquery.dialog() 함수 정렬을 전달하여이 배열을 쉽게 전달할 수 있습니까?
$(document).ready(function() {
// I would like to setup here sort of an array with properties and values
// as basis for each click-handler
/************************* Open template ****************************/
$('#OpenTemplate').click(function (e) {
e.preventDefault();
var link = this;
$('#MyDialog').dialog({
open: function (e) { $(this).load($(link).attr('href')); },
title: link.innerHTML,
autoOpen: true,
modal: true,
show: 'fade',
hide: 'fade',
width: 250,
height: 200,
buttons:
{
"OK": function() { openTemplate($(this), $('form', this)); },
"Cancel": function() { $(this).dialog("close"); }
}
});
});
/************************* Create template ****************************/
$('#CreateTemplate').click(function (e) {
e.preventDefault();
var link = this;
$('#MyDialog').dialog({
open: function (e) { $(this).load($(link).attr('href')); },
title: link.innerHTML,
autoOpen: true,
modal: true,
show: 'fade',
hide: 'fade',
width: 250,
height: 200,
buttons:
{
"OK": function() { createTemplate($(this), $('form', this)); },
"Cancel": function() { $(this).dialog("close"); }
}
});
});
});
나는 기본을 무시 제안 : 당신이 dialogObject에 버튼을 추가해야하는 경우
: 당신이 다음 높이를 변경하려면, 다음과 같이 수행하여 기존의 대화를 변경할 수 있습니다 옵션. http://stackoverflow.com/questions/2287045/override-jqueryui-dialog-default-options –