Question: I am trying to animate a footer section in a webpage, and found out that the jQuery `.animate()` method doesn't 'animate' when using percentages (apparently is a bug still not fixed as of jQuery 1.10.2?). So, as suggested by [another answer on SO](https://stackoverflow.com/questions/6877081/jquery-animate-and-property-values-in-percentage) I should use notation for the parent's height, plus `'px'` to allow jQuery to animate properly. So I tried that, but this breaks the function :/

From my [JS Fiddle](http://jsfiddle.net/zYzT2/), I have this code:

```
$(function () {
 var open = false;
 $('#footbutton').click(function () {
     if (open === false) {
         $('#footcontent').animate({
             height: '100%'
         });

         open = true;
     } else {
         $('#footcontent').animate({
             height: '0px'
         });

         open = false;
     }
   });
  });

```

This works, except, the `#footcontent` div instantly pops open with no animation (but works fine when closing, as I have height set in px). Replacing `height: '100%'` with `height: $('footer').height() +'px'` breaks the function, where for some reason jQuery now sees the parent's height at 0px and cannot make any changes in height.

How can the two be different? I've tried replacing `$('footer').height()` with `$(#footcontent).parent().height()` and it's a no-go as well. Surely I'm missing something here or just being dense...it is 4am my time........

Answer: 
Just throwing out ideas there. The current setup looks like this

```
+------------+            +------------+
|    CGI     |----------->|   Apache   |
|  Program   |<-----------|   Server   |    
+------------+            +------------+

```

How about something like this

```
+------------+    +------------+    +------------+
|   Daemon   |--->|    CGI     |--->|   Apache   |
|  Program   |<---|  Passthru  |<---|   Server   |
+------------+    +------------+    +------------+

```

Basically, move all of the functionality of your current program into a daemon that is launched once at startup. Then create a tiny passthru program for Apache to launch via CGI. The passthru program attaches itself to the daemon using IPC, either shared memory, or sockets. Everything that the passthru program receives on stdin, it forwards to the daemon. Everything that the passthru program receives from the daemon, it forwards to Apache on stdout. That way Apache can launch/kill the passthru program as it pleases, without affecting what you're trying to do on the backend.
You might check out [FastCGI](https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html). It allows you to stick closely to the CGI programming model but decouples request lifetime from process lifetime. You could then do something like this:

```
while (FCGI_Accept() >= 0) {
    // handle normal request
    FCGI_Finish();
    // do synchronous I/O outside of request lifetime
}

```