Hi David,

a close button is quite simple, see:
  http://jsbin.com/ocoyo/edit
for an example

1. Why do you escape the quotes in $(\'#triggerReg\')? Is this just a
copy&paste error, or do you define your function in an HTML attribute?

2. The click handle does take only one callback function (in contrast
to hover, which takes two)

What exactly does not work? Do you get an error from the browser? Does
the menu not open / not close? ...

try this:

$("#triggerReg").click(function(){
  $("#menuReg").show();
  return false;
});
$("#menuReg").click( function(){
  $("#menuReg").hide();
 return true;
});


by(e)
Stephan

2009/2/16 David Blomstrom <david.blomst...@gmail.com>:
> I haven't learned how to make a close button yet. I tried the second method,
> but I'm doing something wrong. I combined the two scripts as follows, but it
> doesn't work.
>
> $(\'#triggerReg\').click(function(){
>
>   $(\'#menuReg\').show();
> },function(){
>
>
> $("#menuReg").click( function(){
>  $(this).hide();
>  return true;
> });
>
> Thanks!
>
> * * * * *
>
> On Mon, Feb 16, 2009 at 1:41 AM, Stephan Veigl <stephan.ve...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I would add a close button (or link) to your links div and add something
>> like:
>>
>> closeBtn.click( function(){
>>  $(this).parent().hide();
>> });
>>
>> alternatively you can do:
>>
>> $("#menuReg").click( function(){
>>  $(this).hide();
>>  return true;
>> });
>>
>> Than your menu is closed whenever you click somewhere within your
>> menu. If you click on a link, the link will be followed (return true;)
>>
>> by(e)
>> Stephan
>>
>> 2009/2/16 WebRanger <david.blomst...@gmail.com>:
>> >
>> > The following script produces a box that opens on mouseover and closes
>> > on mouseover.
>> >
>> > $(\'#triggerReg\').hover(function(){
>> >    // do something on mouse over
>> >    $(\'#menuReg\').show();
>> > },function(){
>> >    // do something on mouse out
>> >    $(\'#menuReg\').hide();
>> > });
>> >
>> > It works fine for displaying brief text messages. But if you display a
>> > column of links, it closes as soon as you try to put the cursor over a
>> > link.
>> >
>> > Can someone show me how to modify this so that the menu stays open
>> > until you manually close it again? I changed hover(function() to click
>> > (function(), and it now opens when you click it - and it stays open.
>> > But I can't figure out how to close it.
>> >
>> > I've been searching for online references that list the various
>> > options, but I haven't found one I can understand yet.
>> >
>> > Thanks.
>
>
>
> --
> David Blomstrom
> Writer & Web Designer (Mac, M$ & Linux)
> www.geobop.org
>

Reply via email to