본문 바로가기

JavaScript/jQuery

[jQuery] id값으로 다중 모달 띄우기

1. HTML
   

    

2.script

   function fnShowPop(sGetName){
    var $layer = $("#"+ sGetName);
    var mHeight = $layer.find(".m_content").height()/2;
    $layer.find(".m_content").css({'margin-top':-mHeight});
    $layer.addClass("on");
}

function fnHidePop(sGetName){
    $("#"+ sGetName).removeClass("on");
}

3.css


  
.modal{position:fixed;width:100%;height:100%;top:0;left:0;bottom:0;background-color:rgba(0,0,0,.8);z-index: -1;opacity:0;transition:all 0.2s;}
.modal.on{opacity:1;z-index:999;}