单击锚点链接后关闭弹出窗口

问题描述

我需要一些帮助来弄清楚如何使锚链接正常工作以及随后关闭弹出窗口。 当前,弹出窗口有效,但是在单击锚链接后仍保持打开状态。这是针对WordPress中的一页布局。

HTML

<div class="popup1" data-popup="popup-1">
<div class="cnt223">
<a data-popup-close="popup-1" href="#" class="close"><i class="fa fa-times" aria-hidden="true"></i>
</a>    
<h2>Re-Opening Soon!!!</h2>
<h2><a style="font-size:22px;color:#bc2a3a;" href="/#facility">Click Here to See Our New Facility</a></h2>  
</div>

    <div class="close-layer" data-popup-close="popup-1">
    </div>
</div>

CSS

<style>
.popup1 {
    width:100%;
    height:100%;
    position:fixed;
    top:0px;
    left:0px;
    z-index:999999;
}
    .close-layer{top:0px;
    left:0px;
    background:rgba(0,0.30);width:100%;
    height:100%;     position: absolute;
    z-index: 999;}
    
   .cnt223 {
    z-index: 9999;
}
/* Inner */
.popup-inner {
    max-width:700px;
    width:90%;
    padding:40px;
    position:absolute;
    top:50%;
    left:50%;
    -webkit-transform:translate(-50%,-50%);
    transform:translate(-50%,-50%);
    box-shadow:0px 2px 6px rgba(0,1);
    border-radius:3px;
    background:#fff;
}

/* Close Button */
.popup-close {
    width:30px;
    height:30px;
    padding-top:4px;
    display:inline-block;
    position:absolute;
    top:0px;
    right:0px;
    transition:ease 0.25s all;
    -webkit-transform:translate(50%,-50%);
    transform:translate(50%,-50%);
    border-radius:1000px;
    background:rgba(0,0.8);
    font-family:Arial,Sans-Serif;
    font-size:20px;
    text-align:center;
    line-height:100%;
    color:#fff;
}

.popup-close:hover {
    -webkit-transform:translate(50%,-50%) rotate(180deg);
    transform:translate(50%,-50%) rotate(180deg);
    background:rgba(0,1);
    text-decoration:none;
}
.popup-1 {animation: popup 1 3s ease-in-out;}

@keyframes popup {
    0% {
        opacity: 0;
    }
    
    100% {
        opacity: 1;
    }
     0% {
       opacity: 0;
       visibility: hidden;
   }

   100% {
       opacity: 1;
       visibility: visible;
   }
}

</style>

JavaScript

<script type='text/javascript'>
jQuery(function() {
    //----- OPEN
    jQuery('[data-popup-open]').on('click',function(e) {
        var targeted_popup_class = jQuery(this).attr('data-popup-open');
        jQuery('[data-popup="' + targeted_popup_class + '"]').fadeIn(350);
        

        e.preventDefault();
    });

    //----- CLOSE
    jQuery('[data-popup-close]').on('click',function(e) {
        var targeted_popup_class = jQuery(this).attr('data-popup-close');
        jQuery('[data-popup="' + targeted_popup_class + '"]').fadeOut(350);

        e.preventDefault();
    });
    //----- CLOSE
    jQuery('[data-popup-close2]').on('mouseup',function(e) {
        var targeted_popup_class = jQuery(this).attr('data-popup-close');
        jQuery('[data-popup="' + targeted_popup_class + '"]').fadeOut(350);

        e.preventDefault();
    });
});
    
</script>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...