Codex,

I played with your code and this is what I found:

Yes,  It acted "wierd!" <g>

First, I think that was because of the onFocus= on the <a> tag link
which will fool with your mind depending on where is the current
keyboard focus including switching browser pages. :-).

Changing it to OnClick=  begins to bring sanity to getting it worked
out.

Second, the toggle was being acted on the #mail_code id rather than
the #prep-mail_code.  If that is some cool trick you were thinking of,
it certainly confused the hell out of mail

Anyway, after that I changed you readmail() function to:

function readmail (mail_code) {
    var $p = $('#prep-'+ mail_code);
    if ($p.is(":hidden")) {
       // Its hidden so toggled it on and do a AJAX call
       $p.toggle();
       $.post("/jquery-fake-mail.wct",
              {},
              function(response){
                  // Hide the spinner
                  $("#spinner-"+ mail_code).fadeOut(500);
                  // Populate the prepared p-element with the response
                  $("#prep-"+ mail_code).html(response).fadeIn(500);
              }
       );
    } else {
       // Its showing so slowly fade away and hide it
       $("#prep-"+ mail_code).fadeOut(500);
    }
   return false;
};

it was a thing of beauty! <g>

Note, the .post() command.  I have my fake url there so I can dump
text for this testing .  Put back your URL there and it should work.

Finally, if you really wanted the onfocus, you can now better begin to
explore that to auto-turn off stuff.  But I would pay attention to
window switching issues there.  :-)

--
HLS

On Aug 21, 10:13 am, Pops <[EMAIL PROTECTED]> wrote:
> On Aug 20, 4:50 pm, Codex <[EMAIL PROTECTED]> wrote:
>
> > It's sort of working, but the toggle seems to be acting weird. Can
> > someone please go over the code and tell me what I might be doing
> > wrong?
>
> A quick scan appears to be logical.
>
> What's wrong?  Describe "Acting Wierd."  By not being specific, it
> forces people who may be interested in helping to actually spent more
> time to prepare a test bed to see what you  see as "wield."
>
> A good development tip as well as tip when seeking public help:
>
> Try to reduce your code to a "plain vanilla" example where there are
> no other dependencies, thus using divide and conquer" techniques by
> separating the functional parts.  You reduce the amount of people who
> can help when posting highly specific code.  You never know. You might
> even find the problem by dividing and conquering each part. I know it
> does for me, atleast 99% of the time. :-)
>
> --
> HLS

Reply via email to