当我通过 Stackoverflow 和 Google 进行搜索时,我找不到简化代码的解决方案(或者我可能没有找到确切的搜索词)。我无法简化下面的代码真的让我很烦恼。
因为我是这个领域的初学者,所以当我可以结合相似之处时,我不得不重新重复所有相同的代码。
非常感谢您的帮助!
$('.detail-view').dialog({
autoOpen: false,
draggable: false,
resizable: false,
closeOnEscape: true,
modal: true,
height: 'auto',
width: 600,
position: ['top', 150] });
$('.forgotpass').dialog({
autoOpen: false,
draggable: false,
resizable: false,
closeOnEscape: true,
modal: true,
height: 'auto',
width: 400,
position: ['top', 150] });
$('.user0').load('php/usersetting.php').dialog({
autoOpen: true,
draggable: false,
resizable: false,
closeOnEscape: false,
modal: true,
height: 'auto',
width: 500,
position: ['top', 150],
open: function(){
$(this).parent().find('.ui-dialog-titlebar-close').hide();
} });
$('.user1').load('php/usersetting.php').dialog({
autoOpen: false,
draggable: false,
resizable: false,
modal: true,
height: 'auto',
width: 500,
position: ['top', 100] });
$('.user2').load('php/usersetting.php').dialog({
autoOpen: true,
draggable: false,
resizable: false,
closeOnEscape: true,
modal: true,
height: 'auto',
width: 500,
position: ['top', 150],
open: function(){
$(this).parent().find('.ui-dialog-titlebar-close').hide();
}
});