Search code examples
javascriptjquerypopupbpopup

Jquery PopUp Just One Time


I am trying to resolve this.

In my page I have the Bpopup plugin. so here is my code:

SCRIPT:

<script type="text/javascript">

$(document).ready(function() {
    $('#element_to_pop_up').bPopup({
        speed: 650,
        transition: 'slideDown'
    });
});
</script>

ELEMENT THAT SHOWS THE POPUP

<div id="element_to_pop_up">
 <a class="b-close"><a/>

<p> hi </p>

</div>

What I want to do is to make that popup appear only once a day. I know it has something to do with cookies. Please help me.


Solution

  • jQuery approach

    $.cookie("popup_showed", 1, { expires : 1 });
    

    and then get the value of the cookie to check if was already shown:

    $.cookie("popup_showed");
    

    See more at Kazar's post and jQuery.cookie plugin

    PS. Try not using the capslock - it makes your post less readable.