Скрытие блоков jQuery

281
25 мая 2017, 10:37

Доброго времени суток,

У меня есть функция для открытия скрытого div внутри div, но функция будет работать и открывать скрытый блок только если она находится внутри самого этого div блока, выглядит она следующим образом, но мне надо чтобы функция могла открывать этот блок и другой блок с другим классом! Помогите пожалуйста, может другую функцию добавить?

$(".open").click( 
  function() { 
    openBlock($(this)); 
  }); 
 
 
function openBlock(el) { 
  var el = el, 
    input = el.find("input[type=checkbox]").eq(0); 
  if (input.prop("checked")) { 
    el.parent().parent().children(".open-this").css("display", "block"); 
  } else { 
    el.parent().parent().children(".open-this").css("display", "none"); 
    el.parent().parent().children(".open-this").children().children(".question").children(".clear-input").val("0"); 
    el.parent().parent().children(".open-this").children("0.question").children(".clear-input").val("0"); 
    el.parent().parent().children(".open-this").children(".question").children(".test-checkbox").children("input").removeAttr("checked"); 
    el.parent().parent().children(".open-this").children(".question").children(".test-checkbox").children("input").removeProp("checked"); 
    el.parent().parent().children(".open-this").children(".question").children(".test-checkbox").css("background-position", "0 0"); 
    changeCheckStart($(this)); 
  } 
  return true; 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div> 
  <span class="test-checktext" style="font-weight: bold">Тут текст</span> 
  <div class="helper"></div> 
  <span class="test-checkbox open"> 
    <input type="checkbox"> 
    <label for="payt3"></label> 
    </span> 
</div> 
<div class="open-this" style="display: none;"> 
  <div class="question"> 
    //ТУТ КАКОЕ НИБУДЬ СОДЕРЖИМОЕ 
  </div> 
</div>

READ ALSO
SCE baseline region

SCE baseline region

Есть карта распределения тарифов SCE(Southern California Edison) по регионамНеобходимо определить к какому региону относится конкретный адрес, найти...

202
Треугольник адаптивно?

Треугольник адаптивно?

Подскажите пожалуйста, как сделать блок с текстом как на картинке, чтобы если текст расширяет блок триугольник растягивался вместе с блоком

364