Click in Jquery does not work

0

As per this question I previously asked and it was resolved I have another question that happens after that.

$(".membrosClick").click(function() {
  var el = $(this);
  el.css("width", "766px");
  el.children().show();
});

$(".membrosFechar").click(function() {
  $(".listagemEsc").hide();
});
<li class="membrosClick">
  <div name="Listagem de Membros" style="background-image: url('./imagens/EDGAR-GUERRA.png'); width:383px; height:849px">
    <div class="editable subir">
      <h2>Edgar</h2>
      <h3>Guerra</h3>	
      <div class="bandaBarra bandaBarraBranca margin-left-65 margin-top-10 barraNone"></div>
    </div>

  </div>
  <div class="listagemEsc p-relative">
    <div class="membrosFechar"></div>
    <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo.</span>
  </div>
</li>
<li class="membrosClick">
  <div name="Listagem de Membros" style="background-image: url('./imagens/ANTONIO-GUERRA.png'); width:383px; height:849px">
    <div class="editable subir">
      <h2>Antônio</h2>
      <h3>Guerra</h3>	
      <div class="bandaBarra bandaBarraBranca margin-left-65 margin-top-10 barraNone"></div>
    </div>

  </div>
  <div class="listagemEsc p-relative">
    <div class="membrosFechar"></div>
    <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo.</span>
  </div>
</li>

When I click on membrosClick it leaves the div with 766px. With this the listagemDesc appears. This is working perfectly. However, there is a div inside called membrosFechar , which is an X that I made for when the user clicked, the listagemDesc div stays with display:hide and I think the ideal is also the membrosClick div with 383px, which is its original size before the click. I can not do that.

UPDATE

I was able to resolve it, just include event.stopPropagation(); as answered in the SOen .

    
asked by anonymous 12.03.2015 / 22:18

1 answer

1
$('.listagemEsc').click(function(){
    $(this).parent('.membrosClick').width(383);
});

Updated:

$('.membrosFechar').click(function(){
    $(this).parent().parent('.membrosClick').width(383);
});

Updated:

$('.membrosFechar').on('click', function(){
    $(this).parent().parent().css('width', '383px');
});

If it does not work, I give up rsrs

$('.membrosFechar').on('click', function(){
    $(this).parent().parent().css('width', '383px');
    $(this).parent().hide();
});
    
12.03.2015 / 22:30