Automatically close form after 5 sec

Discussion in 'HTML & Website Design' started by doktorrr, Nov 4, 2012.

  1. #1
    I create this code to put facebook like box on right side on my site:
    <div style="position:fixed; bottom:5px; right:2px; background: white; width: 120px; height: 122px;">MY FACEBOOK LIKEBOX</div>

    It work OK, but I want to add option that user can see this just one time so that this form doesn't show anymore for those user until another day.

    Can you help me with this?
     
    Last edited: Nov 4, 2012
    doktorrr, Nov 4, 2012 IP
  2. doktorrr

    doktorrr Member

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    Solved. I put this in my head section:


    <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> <script type="text/javascript" src="https://github.com/carhartl/jquery-cookie/raw/master/jquery.cookie.js"></script> <script type="text/javascript"> $(document).ready(function() { if( $.cookie('showOnlyOne') ){ //it is still within the day //hide the div $('#shownOnlyOnceADay').hide(); } else { //either cookie already expired, or user never visit the site //create the cookie $.cookie('showOnlyOne', 'showOnlyOne', { expires: 1 }); //and display the div $('#shownOnlyOnceADay').show(); } }); </script> </head>
     
    doktorrr, Nov 4, 2012 IP
  3. karan1149

    karan1149 Greenhorn

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Thanks! I wanted to do something similar with a link to register.
     
    karan1149, Nov 8, 2012 IP