I want to Add a lightbox sign up form to my website?

  • Profile Image
    kidtory
    Asked on January 04, 2012 at 04:34 PM

    How can I add a lightbox signup form to my website. I would like to delay the popup for about 15-20 secs? I would really appreciate any help.

     

    Thank you!

  • Profile Image
    fxr
    Answered on January 05, 2012 at 07:47 AM

    Please review this little piece of php which makes use of a session cookie to provide the functionality you are looking for:

     

    <?php

    $showlightbox="0";

    if(!isset($_COOKIE['beenhere'])) { 

    // FIRST VISIT TO WEBPAGE

        setcookie("beenhere", '1');

    $showlightbox="1";

    }

     

    ?>

     

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    <html><head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <?

    if ($showlightbox) {

    sleep(20);

    echo "<script src=\"http://www.jotform.com/min/g=feedback\" type=\"text/javascript\">new JotformFeedback({formId:'13561923201',base:'http://www.jotform.com/',windowTitle:'Title Me',background:'#FFA500',fontColor:'#FFFFFF',type:false,height:500,width:700,openOnLoad:true });</script>";}

    ?>

    </head>

    A test page with that code on it is here: -> 
    This cookie will only be destroyed when the browser window is closed. i.e the lightbox form wont keep appearing if the user navigates to another page on your site, then back to the webpage with the lightbox form on it. 
    The only close you would need to change is the length of the pause before the Lightbox opens, sleep (20) in bold above, (its in seconds). 
    And the actual javascript code for your own form in the php echo command (also in bold)
    Do you think you are would be able to implement something like that on your website? Its may be a little intimidating depending on how much coding you have done, but it should be relatively straightforward to do. 
    Please let us know if you have any questions on any of that. 
  • Profile Image
    fxr
    Answered on January 05, 2012 at 08:18 AM

    Just had a thought, you probably will want to remove this piece of code:

    <?

    if ($showlightbox) {

    sleep(20);

    echo "<script src=\"http://www.jotform.com/min/g=feedback\" type=\"text/javascript\">new JotformFeedback({formId:'13561923201',base:'http://www.jotform.com/',windowTitle:'Title Me',background:'#FFA500',fontColor:'#FFFFFF',type:false,height:500,width:700,openOnLoad:true });</script>";}

    ?>

     

    from the head section of your webpage and put it near the end, after eveything else has loaded as it will prevent other items on your webpage loading. That shouldnt make any difference to how your lightbox form will work.