Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery .slideup function won't hide div

Tags:

jquery

I am using the code below to show and hide a div called "map" When a link with id 'goo' is clicked the map is shown using .slideDown, but when the link is clicked again it is SUPPOSE to use .slideUp to hide the map but nothing happens.

Here is the Javascript:

 $('#goo').live('click',function()  {
   if ($("#map").css('visibility','hidden')){
     $('#map').slideDown('slow');
     $("#map").css('visibility','visible');
     $("#map").css('position','relative');
  } else {
    $('#map').slideUp('slow');
  }
  return false;
  });

If anyone has any idea where the div won't slide up, let me know!

like image 391
user1034180 Avatar asked Apr 06 '26 06:04

user1034180


1 Answers

Use slideToggle method

$('#goo').live('click',function()  {
    $('#map').slideToggle('slow');
    return false;
});
like image 72
ShankarSangoli Avatar answered Apr 08 '26 22:04

ShankarSangoli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!