옵션 추가 및 삭제 스크립트 수정

This commit is contained in:
chicpro
2013-05-27 10:41:40 +09:00
parent df39a3bb59
commit fe5be7ecb7

View File

@ -497,6 +497,7 @@ else
var $el = $(this).closest("li"); var $el = $(this).closest("li");
var del_exec = true; var del_exec = true;
if($("#sit_sel_option .sit_spl_list").size() > 0) {
// 선택옵션이 하나이상인지 // 선택옵션이 하나이상인지
if($el.hasClass("sit_opt_list")) { if($el.hasClass("sit_opt_list")) {
if($(".sit_opt_list").size() <= 1) if($(".sit_opt_list").size() <= 1)
@ -505,6 +506,7 @@ else
if($(".sit_opt_list").size() < 1) if($(".sit_opt_list").size() < 1)
del_exec = false; del_exec = false;
} }
}
if(del_exec) { if(del_exec) {
$(this).closest("li").remove(); $(this).closest("li").remove();
@ -656,13 +658,30 @@ else
opt += "</li>\n"; opt += "</li>\n";
if($("#sit_sel_option > ul").size() < 1) { if($("#sit_sel_option > ul").size() < 1) {
$("#sit_sel_option").html('<ul id="sit_opt_added"></ul>'); $("#sit_sel_option").html("<ul id=\"sit_opt_added\"></ul>");
$("#sit_sel_option > ul").html(opt); $("#sit_sel_option > ul").html(opt);
} else{ } else{
if($("#sit_sel_option > ul li").size() < 1) if(type) {
if($("#sit_sel_option .sit_spl_list").size() > 0) {
$("#sit_sel_option .sit_spl_list:last").after(opt);
} else {
if($("#sit_sel_option .sit_opt_list").size() > 0) {
$("#sit_sel_option .sit_opt_list:last").after(opt);
} else {
$("#sit_sel_option > ul").html(opt); $("#sit_sel_option > ul").html(opt);
else }
$("#sit_sel_option > ul li:last").after(opt); }
} else {
if($("#sit_sel_option .sit_opt_list").size() > 0) {
$("#sit_sel_option .sit_opt_list:last").after(opt);
} else {
if($("#sit_sel_option .sit_spl_list").size() > 0) {
$("#sit_sel_option .sit_spl_list:first").before(opt);
} else {
$("#sit_sel_option > ul").html(opt);
}
}
}
} }
price_calculate(); price_calculate();