У меня есть фрагмент кода, но я не понимая, в которых дети элемент сценария JQuery добавляет класс, как я никогда не использовал .children() метод перед Вот HTML:В каком дочернем div Jquery добавлен класс?
<section class="main">
<div class="click"></div>
<div id="fc-wrapper" class="fc-wrapper">
<!-- right-most handle piece -->
<div class="fc-handle fc-handle-pull"></div>
<div class="fc-perspective">
<!-- right part overlay; get's darker -->
<div class="fc-overlay fc-overlay-reverse"></div>
<!-- middle handle piece -->
<div class="fc-handle fc-handle-out">
<div></div>
</div>
<!-- inner bottom content part -->
<div class="fc-bottom">
<div class="fc-bottom-bg">
<div class="fc-content">
<p>I can live with doubt, and uncertainty, and not knowing. I think it's much more interesting to live not knowing than to have answers which might be wrong. <span>Richard Feynman</span>
</p>
</div>
</div>
<div class="fc-overlay fc-overlay-solid"></div>
</div>
<!-- //fc-bottom -->
<!-- front and back of the flipping half -->
<div class="fc-flip">
<div class="fc-front">
<div class="fc-inner">
<div class="fc-overlay fc-overlay-left"></div>
<!-- left-most part of handle -->
<div class="fc-handle fc-handle-in">
<div></div>
</div>
<div class="fc-content">
<h3><span>♞</span>Free revelations</h3>
<p>by NYCL</p>
</div>
</div>
</div>
<!-- //fc-front -->
<div class="fc-back">
<div class="fc-inner">
<div class="fc-content">
<div class="feynman">
<span>1918 – 1988</span>
</div>
</div>
<div class="fc-overlay fc-overlay-right"></div>
</div>
</div>
<!-- //fc-back -->
</div>
<!-- //fc-flip -->
</div>
<!-- //fc-perspective -->
</div>
<!-- //fc-wrapper -->
</section>
А вот theJQUERY код:
$(function() {
var $wrapper= $('#fc-wrapper'),
$handle = $wrapper.children('div.fc-handle-pull');
$handle.on('click', function(event) {
($handle.data('opened')) ? close() : open();
});
$wrapper.hammer().bind('dragend', function(event) {
switch(event.direction) {
case 'right': open(); break;
case 'left': close(); break;
}
});
function open() {
$wrapper.addClass('fc-wrapper-open');
$handle.data('opened', true);
}
function close() {
$wrapper.removeClass('fc-wrapper-open');
$handle.data('opened', false);
}
});
Я хочу знать, в каком ребенок Jquery добавляет класс 'к-обертку открытой. Пожалуйста, помогите мне . Заранее спасибо .
Это не добавляет класс для всех детей вообще, но к переменной '$ wrapper', которая явно установлена в верхней части к' # й-wrapper' элемент – adeneo
ли это изменение класса от # fc-wrapper до # fc-wrapper-open? Спасибо за ваш повтор –