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

后端 未结 3 443
星月不相逢
星月不相逢 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条回答
  •  Happy的楠姐
    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 = $('
    '); $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/

提交回复
热议问题