-2

I need to add a 5 minute cookie to the code below so once ad is close it will come back in 5 minutes again, right now it shows on every page load

<div id="catfish" style="position:fixed; bottom:0; left:0; right:0; text-align:center;  z-index:5000; width: 468px; margin: 0px auto;">
<div style="position:absolute;  margin-bottom:0px; z-index:15;">
<a href="Javascript:void(0);"onclick="document.getElementById('catfish').style.display='none'"><img src="" alt="close" height="20"></img></a>
</div>
<div>

</div>

1 Answers1

0

For example! Remade to fit your needs.

    var cookieName = "checkss";
    var cookieValue = "true";
    var сookieExist = 1000*60*5;
    var checkCookie = document.cookie;
    if(checkCookie.indexOf(cookieName)==-1) {
        function start() {
            $("#test_infa").modal({
                close: true
            });
        }
        $(document).ready(function(){
            setTimeout(start, 5000);
        });

        var exp = new Date();
        exp.setTime(exp.getTime() + сookieExist);
        document.cookie = cookieName + "=" + cookieValue + "; expires=" + exp.toGMTString();
    }
Ilya Yaremchuk
  • 2,007
  • 2
  • 19
  • 36