duanliao5995 2014-09-06 05:30
浏览 44
已采纳

在弹出窗口中禁用父页面中的链接

am using the following code to create popup and when popup appears link in parent window are active
*how do i make the parent page inactive while popup active CSS

.popup { position: fixed;background: rgba(255,255,255,.6); left: 25%; top: 25%; width: 50%; height: 350px; margin-top: -75px; background-color: #fff; border: 1px solid #ccc; border-radius: 5px;index: 1;}
        .popup .close {position: absolute; right: -5px; top: -5px; text-decoration: none; background-color: #c41e1e; color: #fff; line-height: 1; border-radius: 50px; width: 1em; text-align: center; z-index: 3;}
        h3 {margin: 0; padding: 5px 10px; background-color:#8AC007;}
        .mask {background-color: #000; z-index: 1; position: absolute; width: 100%; height: 100%; opacity: 0.5;}

HTML
<div class="popup">
        <h3>Select Your City</h3>
        <a href="#" class="close"
           onclick="document.querySelectorAll('.popup')[0].style.display = 'none';
                   document.querySelectorAll('.mask')[0].style.display = 'none';
                   return false;">&times;</a>
                        <p><h4>Major City's</h4>
        </p>
    </div>

only popup should be active all the other should be inactive

  • 写回答

2条回答 默认 最新

  • 普通网友 2014-09-06 05:45
    关注

    Here is a jQuery solution.

    <style>
        .popup          { position: fixed;background: rgba(255,255,255,.6); left: 25%; top: 25%; width: 50%; height: 350px; margin-top: -75px; background-color: #fff; border: 1px solid #ccc; border-radius: 5px;index: 1; box-shadow: 2px 2px 10px rgba(0,0,0,0.6); }
        .popup .close   {position: absolute; right: -5px; top: -5px; text-decoration: none; background-color: #c41e1e; color: #fff; line-height: 1; border-radius: 50px; width: 1em; text-align: center; z-index: 3; cursor: pointer; padding: 2px 3px 3px 3px; }
        .popup .close:hover { background-color: #888; }
        h3              {margin: 0; padding: 5px 10px; background-color:#8AC007;}
        .mask           {background-color: #000; z-index: 1; position: absolute; width: 100%; height: 100%; opacity: 0.5;}
        #supawrap       { display: none; height: 100%; width: 100%; position: absolute; background-color: rgba(0,0,0,0.8); top: 0; left: 0; }
    </style>
    HTML
    <div id="supawrap">
        <div class="popup">
            <h3>Select Your City</h3>
            <div class="close">&times;</div>
                            <p><h4>Major City's</h4>
            </p>
        </div>
    </div>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
    <script>
        $(document).ready(function() {
                $('#supawrap').fadeIn('fast');
                $('.close').click(function() {
                    $('.popup').fadeOut('fast');
                    $('#supawrap').delay(300).fadeOut('fast');
                });
            });
    </script>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于作物生长模型下,有限水资源的最大化粮食产量的资源优化模型建立
  • ¥20 关于变压器的具体案例分析
  • ¥15 生成的QRCode圖片加上下載按鈕
  • ¥15 板材切割优化算法,数学建模,python,lingo
  • ¥15 科来模拟ARP欺骗困惑求解
  • ¥100 iOS开发关于快捷指令截屏后如何将截屏(或从截屏中提取出的文本)回传给本应用并打开指定页面
  • ¥15 unity连接Sqlserver
  • ¥15 图中这种约束条件lingo该怎么表示出来
  • ¥15 VSCode里的Prettier如何实现等式赋值后的对齐效果?
  • ¥20 keepalive配置业务服务双机单活的方法。业务服务一定是要双机单活的方式