弹出和覆盖页面

问题描述:

我创建了一个带有覆盖(弹出页面加载到div)的弹出页面,但我的选项关闭弹出没有显示出来。弹出和覆盖页面

这里是链接的弹出窗口: http://jymeross.com/project5.html

我如何关闭窗口(.cancel类)出现在哪里?在“X”链接目前只在这里展示: http://jymeross.com/project5.html#loginScreen

下面的代码

<head> 

<link rel="stylesheet" href="slider1.css" type="text/css" charset="utf-8" /> 

<style type="text/css"> 
.button 
{ 
    width: 150px; 
    padding: 10px; 
    background-color: #FF8C00; 
    box-shadow: -8px 8px 10px 3px rgba(0,0,0,0.2); 
    font-weight:bold; 
    text-decoration:none; 
} 
#cover{ 
    position:fixed; 
    top:0; 
    left:0; 
    background:rgba(0,0,0,0.6); 
    z-index:50; 
    width:100%; 
    height:100%; 
    display:none; 
} 
#gallery 
{ 
    height:525px; 
    width:675px; 
    margin:0 auto; 
    position: relative; 
    z-index:100; 
    display:none; 
    border:5px solid #cccccc; 
    border-radius:10px; 
} 
#gallery:target, #gallery:target + #cover{ 
    display: block; 
    opacity:2; 
} 
.cancel 
{ 
    display:block; 
    position:absolute; 
    z-index:100; 
    top:3px; 
    right:2px; 
    height:30px; 
    width:35px; 
    font-size:30px; 
    text-decoration:none; 

} 
</style> 


</head> 

<body> 


<br><br> 
<div align="center"> 
<a href="#gallery" onclick="load_project1()" class="button">View Gallery</a> 

</div><!--close center--> 


<div id="gallery"> 
    <a href="#" class="cancel">&times;</a> 
</div><!--close gallery--> 

<div id="cover"> 
</div> 

<script> 

    function load_project1() { 
    document.getElementById("gallery").innerHTML='<object type="text/html" width="575" height="325" data="project1.html"></object>'; 
    } 

</script> 


</body> 
+0

什么JavaScript库你用这个弹出?这是关于CSS错误或JS,但?你会指定你做了什么来完成什么,到目前为止还没有工作吗? – Codemole

+0

我使用CSS弹出。在弹出窗口中,当我在底部添加脚本以在弹出式div中加载另一个html页面时,即丢失.cancel类(“x”以关闭弹出窗口)。 –

让画廊下方的次DIV,然后加载内容到div。

<div id="gallery"> 
    <a href="#" class="cancel">&times;</a> 
    <div id="gallery-body"></div> 
</div> 


function load_project1() { 
    document.getElementById("gallery-body").innerHTML='<object type="text/html" width="575" height="325" data="project1.html"></object>'; 
    } 

然后你会保持关闭的链接。