简体   繁体   中英

Child popup window shown on top of parent popup window

I have the following code snippet for opening a child window which should stay on top of the parent window

"var a = window.open('" + url + "', '_blank','height=400,width=400,status=yes,toolbar=no,menubar=no,location=no');";

However, popup window is opening and not shown on top of the parent window.

And I would like to keep the keep the child window stacked and no other child windows should be allowed to open until I close the already opened child window popup.

This issue is only in IE browser.

 $(document).ready(function(){ $('#popup-btn').click(function(){ setTimeout(function(){ $('#popup').css('display','block'); },10); }); }); 
 #parant{ width:300px; height:300px; background:#ff8800; margin:10px auto; border-radius:15px; } #popup{ display:none; width:300px; height:300px; background:#ff8800; margin:10px auto; border:1px solid blue; border-radius:15px; } .name{ width:100%; height:50px; background:blue; color:#fff; text-align:center; border-radius:15px 15px 0px 0px; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="popup"> <div class="name">Child Popup</div> </div> <div id="parant"> <div class="name">Parant Popup</div> <button id="popup-btn">POPUP</button> </div> 

Try this..

define the 'top'

var a = window.open('" + url + "', '_blank','height=400,width=400,status=yes,toolbar=no,menubar=no,location=no,top=0,left=0');

Refer this link

https://developer.mozilla.org/en-US/docs/Web/API/Window/open

<script>
function popup(){
document.getElementById('pop-div').style.display="block";
}
</script>
<body>
  <div style="width:100px; height:100px;display:none;" id="pop-div"></div>
  <button onclick="popup();">pop</button>
</body>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM