I trying to make custom 18+ alert (only on first visit), but it doesn't works.. Basicly in custom html template it worked, but on WordPress doesn't The view on the website And here, how it should looks, but the MUST HAVE thing is that visitor of website must see the website, this is just something like modal..
The second MUST HAVE thing is, it should to show only on first visit, and after I click on "POKRAČOVAT" button, this alert should disappear and doesn't show anywhere on the website. I already tried an cookie way, via. Make a splash screen appear only on first visit in Wordpress (the accepted answer)
And I tried too this way: Display A Popup Only Once Per User (the accepted answer too) but it doesn't works for me.. Let me to show you code below (the second option), in header.php
:
<script type="text/javascript">
$(document).ready(function() {
if(localStorage.getItem('age-test') != 'shown'){
$("#snippet-ageTest-alertbox").delay(2000).fadeIn();
localStorage.setItem('age-test','shown')
}
$('#snippet-ageTest-alertbox-close').click(function(e) // You are clicking the close button
{
$('#snippet-ageTest-alertbox').fadeOut(); // Now the pop up is hiden.
});
$('#snippet-ageTest-alertbox').click(function(e)
{
$('#snippet-ageTest-alertbox').fadeOut();
});
});
</script>
<div id="snippet-ageTest-alertbox">
<div id="age-test" class="main_background" style="display: block;">
<div class="age-test-square main_background clearfix">
<div class="title">
<span>
Pokračovaním potvrzuji, že
jsem starší 18 let
</span>
</div>
<div>
<a class="agree button-conversion" href="#">
Pokračovat
</a>
</div>
</div>
</div>
</div>