jsp

datepicker가 에디터 또는 activex에 가려질때

우주정복☆ 2015. 12. 14. 13:20

$("#달력").datepicker({

onChangeMonthYear: function (year, month, inst) {  

actView(inst.id, "change");

},

beforeShow: function(input, inst) {

objHide();

actView(inst.id, "before");

},

onClose: function(dateText, inst) {

objView(); 

actHide();

},

onSelect: function (dateText, inst) {  

actHide();

}

});


function actView(id, type){

// id : input ID 

//type : 버튼입력(change, before 등)

setTimeout(function() {

        $("#"+id).before("<iframe id='hideFrame' frameborder='0' scrolling='no' style='filter:alpha(opacity=0); position:absolute; "

            + "left: " + $("#ui-datepicker-div").css("left") + ";"

            + "top: " + $("#ui-datepicker-div").css("top") + ";"

            + "width: " + $("#ui-datepicker-div").outerWidth(true) + "px;"

            + "height: " + $("#ui-datepicker-div").outerHeight(true) + "px;'></iframe>");

//$("#ui-datepicker-div").css("z-index", "999"); 먹히지 않을경우 속성값을 바꿔준다.  

    }, 50);

}


//iFrame 숨김

function actHide(){

$("#hideFrame").remove();

}


//여백 없앰

function objHide(){

var twe = document.getElementById("twe");

if ( twe ) {

twe.style.width = '0px';

twe.style.height = '0px';

}

}


//여백 만듦

function objView() {

var twe = document.getElementById("twe");

if ( twe ) {

twe.style.width = '760px';

twe.style.height = '320px';

}

}



//z-index 수정

$("input[name=hDate]").datepicker({

beforeShow: function() { 

setTimeout(function(){

                $('.ui-datepicker').css('z-index', 9999);

              }, 0);

}

});