Html content

<div id="age_popup" class="block block-subscribe">
    <div class="block-content">
        <a id="ageenter" class="enter_exit enter" href="javascript:void(0);" >Click To Enter</a> 
        <a id="exit" class="enter_exit exit" href="https://www.google.com">Click To Exit</a>
    </div>
</div>

Jquery script

<script type="text/javascript">
    jQuery(function($) {
        var check_cookie_age = $.cookie('agevarifypopup');
        if(window.location!=window.parent.location){
            jQuery('#age_popup').remove();
        }
        else{
            if(check_cookie_age == null) {
                setTimeout(function(){
                    beginAgePopup();
                }, <?php echo $delay; ?>);
            }
            else{
                jQuery('#age_popup').remove();
            }
            
        }
    });
    
    function beginAgePopup() {
        jQuery.fancybox({
            'padding': '0px',
            'autoScale': true,
            'transitionIn': 'fade',
            'transitionOut': 'fade',
            'type': 'inline',
            'href': '#age_popup',
            'onComplete': function() {
                $.cookie('age_popup', 'shown');
            },
            'tpl': { 
                closeBtn: '<a title="Close" class="fancybox-item fancybox-close fancybox-age-close" href="javascript:;"></a>'
            },
            'helpers': {
                overlay: {
                    locked: false
                }
            }
        });
        jQuery('#age_popup').trigger('click');
        jQuery('#ageenter').click(function(){
			setCookie();
            jQuery('.fancybox-age-close').trigger('click');
		});
        jQuery('.fancybox-age-close').click(function(){
			setCookie();
		});
        function setCookie() {
            var ThirtyDays = 1000*60*60*24*30;
            var expires = new Date((new Date()).valueOf() + ThirtyDays);
            document.cookie = "agevarifypopup=Age Verify;expires=" + expires.toUTCString();
        }
    }
</script>

working-on-a-computer-smiley-emoticon


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *