دنبال کننده ها

۱۳۹۶ دی ۱۱, دوشنبه

javascript - JS not working to close overlay page

[ad_1]



I'm starting with JS and I have a small problem (I think) with my code.



I'm trying to create an overlay consent page, but it seems my YES (button) is not working properly. When press YES, it should close the overlay and show website content. Can someone help me to fix it?



My website http://consent18.webnode.com/



This is probably a small detail, as always.





< script >
function openDialog(id)
document.getElementById(id).className += "show";
document.documentElement.style.overflow = "hidden";


function closeDialog(id)
document.getElementById(id).className = "warning";
document.documentElement.style.overflow = "visible";
< /script>

<
script >
openDialog("warning"); < /script>

<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" >
< /script>

<script src = "https:/ / maxcdn.bootstrapcdn.com / bootstrap / 3.3 .7 / js / bootstrap.min.js " >
< /script>

body,
html
overflow: hidden;
height: 100%;
margin: 0;


.consent-overlay
position: fixed;
z-index: 999;
top: 0;
left: 0;
right: 0;
bottom: 0;


.consentpage
background: #000015;
height: 100%;
background-position: center;
background-size: cover;
position: relative;
color: #f8f8f8;
font-family: 'Raleway', monospace;


.consent-content
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;


.consent-content h1
text-transform: uppercase;
font-size: 4.8rem;
font-weight: 600;
letter-spacing: .1rem;
padding: 20px;


.consent-content p
font-size: 2.4rem;
font-weight: 800;
text-transform: uppercase;


.button
text-decoration: none;
display: inline-block;
font-size: 40px;
cursor: pointer;
padding: 0px;

<html>

<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>

<body>
<div id="warning" class="consent-overlay show">
<div class="consentpage">
<div class="consent-content">
<div>
<div>
<h1>AVISO</h1>
<p>Este website exibe contéudo explícito!</p>
<div class="button">
<button class="btn btn-success" onclick="closeDialog(&quot;warning&quot;)">Tenho mais de 18 anos</button>
<button class="btn btn-danger" onclick="location.href='https://www.webnode.com.br';">Tenho menos de 18 anos</button>
</div>
</div>
</div>
</div>
</div>
</div>
</body>

</html>






[ad_2]

لینک منبع