// 마우스 길게 누르는 function var onlongclick = function ($target, time, callback) { $($target).on("mousedown", function () { const timer = setTimeout(callback, time); $($target).on("mouseup", function () { clearTimeout(timer); }); }); } var publishCommon = { count: 0, longMousePressCheck: function (checkTarget, checkTime) { // checkTarget → 체크박스([name='']) / checkTime → 몇초 간격으로 체크 될지 var checkLength = checkTarget.length; // 체크박스 몇개인지 var cnt = 0; // 몇개 체크됐는지 var checkEvent = setInterval(function () { if (this.count == 0) {} else if (cnt >= checkLength) { clearInterval(checkEvent); // 자동체크 끝. } $(checkTarget[cnt]).prop('checked', true); // 체크박스 체크. cnt++; fnChkCallToChange(); }, checkTime); }, clickCheck: function (checkTarget) { // 한번 클릭 했을 때 체크, checkTarget → 체크박스([name='']) /*if (checkTarget.length < this.count) { // 체크 다하면 더이상 작동 x. return false; } $(checkTarget[this.count]).prop('checked', true); // 체크박스 체크 this.count++;*/ $("input:checkbox[name='chkCallTo']").each(function(){ var chkSts = $(this).is(":checked"); if(!chkSts){ $(this).prop("checked","true"); return false; } }); }, clickCheckPrice : function(){ fnChkCallToChange(); } }