[CSS] Full screen 팝업 띄우는 방법
                                            
                                                
                                                
                                                
                                                
                                                
                                                 12217 단어  JavaScriptCSSCSS
                    
Intro
기존 웹 서비스에서 띄어주고 있는 팝업의 크기가 작아 사용성이 떨어진다는 피드백을 받았다. 팝업 크기를 full screen으로 띄워주면 좋을 것 같아 수정 작업을 진행했다.
How to Full screen
Step 1) Add HTML
<div id="myNav" class="overlay">
  <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
  <div class="overlay-content">
    <a href="#">팝업 내용</a>
  </div>
</div>
<h2>Fullscreen Overlay Example</h2>
<p>This is an example of a pop-up full screen</p>
<button style="font-size:30px;cursor:pointer" onclick="openNav()">fullscreen open button</button>
Step 2) Add CSS
.overlay {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0, 0.9);
  overflow-x: hidden;
}
.overlay-content {
  position: relative;
  top: 25%;
  width: 100%;
  text-align: center;
  margin-top: 30px;
}
.overlay a {
  padding: 8px;
  text-decoration: none;
  font-size: 36px;
  color: #818181;
  display: block;
  transition: 0.3s;
}
.overlay a:hover, .overlay a:focus {
  color: #f1f1f1;
}
.overlay .closebtn {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 60px;
}
@media screen and (max-height: 450px) {
  .overlay a {font-size: 20px}
  .overlay .closebtn {
  font-size: 40px;
  top: 15px;
  right: 35px;
  }
}- overlay 에 transition 속성 활용 시 애니메이션 효과를 낼 수도 있다. (ex. transition: 0.5s;)
Step 3) Add JavaScript
function openNav() {
  document.getElementById("myNav").style.width = "100%";
}
function closeNav() {
  document.getElementById("myNav").style.width = "0%";
}Step 4) Run
- 
기본 화면 
  
- 
button 클릭 시 팝업이 full screen 이 되는 것을 확인할 수 있다. 
  
https://www.w3schools.com/howto/howto_js_fullscreen_overlay.asp
Author And Source
이 문제에 관하여([CSS] Full screen 팝업 띄우는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@leyuri/CSS-Full-screen-팝업-띄우는-방법저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)