2016-11-17 1 views
0

나는 브라우저 (최신 파이어 폭스) 내 dev 사이트에 팝업을 닫은 후, 뒤로 버튼이 작동하지 않습니다에 뒤로 버튼을 클릭하고 팝업 루프 곳을 일으키는, 다시 열립니다 사용자는 뒤로 버튼을 사용할 수 없습니다.CSS 팝업 최우선 브라우저 버튼

나는 그것이 관련된합니다 (URL에 #) 또는 세션을 재 지정하거나 생각합니다. 그러나 쿠키 스크립트 중 아무 것도 작동하지 않는 것 같습니다. 사용자가 버튼을 클릭하여 열 경우에만 팝업이 열리고 싶습니다.

번째 사이트는 현재 오프라인 상태입니다. 지금은 브라우저와 코드 편집기로 하드 코딩하고 있습니다.

나는 누군가가 내가 부족 무엇인지 말해 줄 수 바라고 있어요. 꽤 간단한 CSS 팝업입니다.

/*Popup*/ 
 
.overlay { 
 
    position: fixed; 
 
    top: 0; 
 
    bottom: 0; 
 
    left: 0; 
 
    right: 0; 
 
    background: rgba(0, 0, 0, 0.7); 
 
    transition: opacity 500ms; 
 
    visibility: hidden; 
 
    opacity: 0; 
 
} 
 
.overlay:target { 
 
    visibility: visible; 
 
    opacity: 1; 
 
} 
 
.popup { 
 
    margin: 70px auto; 
 
    padding: 20px; 
 
    background: #fff; 
 
    border-radius: 5px; 
 
    width: 50%; 
 
    position: relative; 
 
    transition: all 5s ease-in-out; 
 
} 
 
.popup .close { 
 
    position: absolute; 
 
    top: 20px; 
 
    right: 30px; 
 
    transition: all 200ms; 
 
    font-size: 30px; 
 
    font-weight: bold; 
 
    text-decoration: none; 
 
    color: #333; 
 
} 
 
.popup .close:hover { 
 
    color: #08899e; 
 
} 
 
.popup .content { 
 
    max-height: 50%; 
 
    overflow: auto; 
 
} 
 

 
@media screen and (max-width: 700px){ 
 
    .box{ 
 
    width: 70%; 
 
    } 
 
    .popup{ 
 
    width: 70%; 
 
    } 
 
}
<a class="button" href="#popup1" data-rel="back">Let me Pop up</a>. Add more text here... 
 

 
<div id="popup1" class="overlay"> 
 
    <div class="popup"> 
 
    <a class="close" href="#">&times;</a> 
 
    <h2>Title Goes Here...</h2> 
 
    <div class="content"> 
 
     Text goes here.... 
 
    </div> 
 
    </div> 
 
</div>

답변

0

는이 스크립트를 시도 해 봤나 다음은 팝업에 대한 코드는? 지금까지 [질문] 내가 그 스크립트를 시도했습니다 Close pop up on back button

+0

, 그리고 기쁨,하지만 난 변수 중 하나를 변경해야하는 경우 궁금하네요 :

 if (window.location.hash) { if (window.history && history.pushState) { window.history.pushState("", document.title, window.location.pathname); } else { // Prevent scrolling by storing the page's current scroll offset var scroll = { top: document.body.scrollTop, left: document.body.scrollLeft }; window.location.hash = ''; // Restore the scroll offset, should be flicker free document.body.scrollTop = scroll.top; document.body.scrollLeft = scroll.left; } } 

는 또한 당신을 위해 꽃밥 기사를 발견했다. 문서 주셔서 감사합니다. 나는 거기에서도 해답을 시도 할 것이다. – CC87

+0

코드를 codepen 또는 jsfiddle에 붙여 넣을 수 있습니까? – vuquanghoang

+0

이것이 CodePen에 대한 첫 번째 시도이기 때문에 잘 작동합니다. http://codepen.io/anon/pen/wooWyy?editors=1111 – CC87