JavaScript Javascript : difficulties when making a hidden element visible

I have some problems with css manipulation with jQuery. Here is what I need to do. I have these three picture. Each are a representation of a person.

1st picture

When we click on one of those, this div appears:

2nd picture

The problem is when I close it, the website should become as in the first picture, but the 3 picture don't reappear with $("class").css("visibility", "visible"). I don't know why.

The code (there is some PHP, it's done with Wordpress) : Here is the code for the first picture (I will keep it short, it's not relevant) :

 <div class="team-member" style="position:relative; visibility:visible; z-index:-200;"data-style="'.$team_memeber_style.'">
 <img class="img_avocat" alt="'.$name.'" src="' . $image_url .'" title="' . $name . '" /></div>

Here is the code for the second picture :

$html .= '<div class="team-member-container" style="position:relative;z-index:-200">';
$html .= '<div class="avocat_container ' .$i. '"  height="400px" style="width:1250px; height:442px;border:2px solid black;z-index:200;position:absolute;top:-5%;">
<div style="width:400px; display:inline; position:relative; z-index:200" class="photo_container"><img class="img_avocat_cont" style="display:inline; padding-top:23px" width="400px" height="200px" alt="'.$name.'" src="' . $image_url .'" title="' . $name . '" /></div>
<div style="display:inline-block; vertical-align:top;z-index:200; margin-left: 50px;position:relative;padding-top:23px;" class="container_description">
<h3 style="display:block;z-index:200; color:#f5a982;position:relative;">' . $name . '</h3>
<p style="display:block;z-index:200;position:relative;">' . $job_position . '</p>
<p style="display:block;z-index:200;position:relative;">DESCRIPTION</p>
<h4 style="display:block;z-index:200; color:#f18c58;position:relative;">FORMATION</h4>
<h4 style="display:block;z-index:200; color:#f18c58;position:relative;">Expertise</h4>
</div>
<div style="display:inline;" class="avocat_close"><img style="display:inline;float: right;padding-top: 20px; padding-right:20px;" src="http://scmlibravocats.lagencecocoa.com/wp-content/uploads/2015/11/croix_fermeture.png" /></div>
<div style="display:inline; margin-left:28%;" class="avocat_mail"><img style="display:inline;padding-right:10px;"src="http://scmlibravocats.lagencecocoa.com/wp-content/uploads/2015/11/mail.png" />Envoyer un message</div>

';

$html .= '<div class="testo team-member" style="position:relative; visibility:visible; z-index:-200;"data-style="'.$team_memeber_style.'">';

The Jquery code :

$(".avocat_container").hide();
var on = 0;
$(".team-member-container").click(function () {
    if (on == 0) {
        $(this).find(".avocat_container").fadeIn("slow");
        $(".team-member").css("visibility", "hidden");
        on = 1;
    }
});
$(".photo_container").click(function() {

    $(".avocat_container").fadeOut("slow");
    $(".avocat_container").css("visibility", "hidden");
            $(".testo").fadeIn("slow");
    $(".team-member").style.visibility = "visible";
    on = 0;
});
});
Answer:1

I would actually use min-height for this, and you'd also get a nice slide-down transition. Basic idea is to set your 2nd div to min-height:0;, then in JQuery use a click event on the other div to increase min-height. If you keep the z-index of the 2nd div higher than the first, it will appear overtop of it. To close it, attach a click event that resets min-height:0;. Add transition:min-height .4s ease; to your 2nd div and you've got a nice little effect!

Answer:2

I am working on a javascript problem for fun that is supposed to take a string and return nested arrays that contain one array for every character that repeats. The groups should have the following ...

I am working on a javascript problem for fun that is supposed to take a string and return nested arrays that contain one array for every character that repeats. The groups should have the following ...

  1. finding last index of string in java
  2. finding last index of a string in oracle

I've got a small problem in my javascript which i am stuck on for a while now. What i did is : Create an empty table. Generate the tr/td tags and values inside the table(from JSON-object). for (...

I've got a small problem in my javascript which i am stuck on for a while now. What i did is : Create an empty table. Generate the tr/td tags and values inside the table(from JSON-object). for (...

I have am trying to create jQuery code which adds a active-menu class to a link whenever I click on it. However I need to check first if it already has the class before adding. I only need the link ...

I have am trying to create jQuery code which adds a active-menu class to a link whenever I click on it. However I need to check first if it already has the class before adding. I only need the link ...

On my website, I have an slider with images. In the backend, the current slider images are displayed as well as a button that adds an input field, so I can upload new images for the slider. The code ...

On my website, I have an slider with images. In the backend, the current slider images are displayed as well as a button that adds an input field, so I can upload new images for the slider. The code ...

  1. get file from form php
  2. save file from form php
  3. file itr from form 16
  4. upload file from form
  5. php file from form
  6. upload file from form php
  7. upload file from form ajax
  8. send file from form
  9. download file from form
  10. post file from form
  11. submit file from form
  12. file from html form
  13. curl file from form
  14. file form 941 online
  15. file form d
  16. file form 941
  17. file form 990-n
  18. file form 1040
  19. file form 7004 online
  20. file form 4868 online