How to disable parent window while child window appear by clicking button on parent window

后端 未结 3 424
星月不相逢
星月不相逢 2021-01-14 04:42

I have designed one window in jsp in which there is a search button. when user clicks \"search\" button, the new window appears. But at this time i want my parent window to

相关标签:
3条回答
  • 2021-01-14 05:02

    The way I present modal windows is I create a DIV that covers the entire document, with a high Z-index, and then I prevent propagation of click events. In jQuery, I'd do it like this:

    // When popup window is open:
    var $cover = $('<div>');
    $cover.css({
      height: $(document).height(),
      width: $(document).width(),
      margin: 0,
      padding: 0,
      background: 'black',
      opacity: 0.5
    });
    $cover.click(function(e) {
       e.stopPropagation();
       return false;
    });
    $cover.appendTo(document);
    

    EDIT: Here's something I did quick-and-dirty using pure JS. I'm sure it can be improved for better cross-browser support.

    http://jsfiddle.net/wVNbx/1/

    0 讨论(0)
  • 2021-01-14 05:08

    You can use Greybox . Please visit the link : http://orangoo.com/labs/GreyBox/

    Hope this will suffice your requirement.

    0 讨论(0)
  • 2021-01-14 05:18
    function openSearchPopUp() { 
      popupWindow= window.open(url,'window','width=800,
                               height=600,location=yes,
                               menubar=‌​yes,scrollbars=yes,
                               resizable=yes'); 
      popupWindow.focus(); 
      document.onmousedown = focusPopup; 
      document.onkeyup = focusPopup; 
      document.onmousemove = focusPopup; 
    } 
    
    function focusPopup() {
      if(popupWindow && !popupWindow.closed) { popupWindow.focus(); } 
    } 
    
    0 讨论(0)
提交回复
热议问题