jquery index()는 요소 중 하나를 인식하지 못하는 것처럼 보입니다. 항상 "정의되지 않은 'length'of undefined"속성을 읽을 수 없습니다. 여기 내 코드입니다. 문제가있는 숫자는 m number입니다. 숫자가 필요합니다. mnumber를 사용하여 마우스를 추적하고 마우스를 가져다 놓은 상자에 올바른 값 기반을 제공 할 수 있습니다.jquery .index()
$(".module-details-lesson-container").hover(function() {
var number = $(".module-details-lesson-container").index(this) - 9;
var mnumber = $(".module-container").index(this);
jQuery.each(modules[1][number], function (index, value) {
$(".module-details-words-learned-body").eq(1).append("<div class='module-details-word'>" + value + '</div>');
});
}, function() {
$(".module-details-word").remove();
});
CSS 파일
<div class="module-container">
<div class="module-tab envelope-heading white-font"></div>
<div class="module-body">
<div class="module-details-lesson-container"></div>
<div class="module-details-lesson-container"></div>
</div>
<div class="module-details-words-learned">
<div class="module-details-words-learned-body ">
<div class="module-details-word"></div>
</div>
</div>
</div>
내가 무엇을 사용해야합니다 -container, 이것은 .module-details-lesson-container의 부모 컨테이너이며,이 페이지에는 10 개의 모듈 컨테이너가 있습니다. –
@ will.i.am 제 생각에는, 다음과 같은 것이 있습니다 : http://jsfiddle.net/ ngkpB/1/ – webdeveloper
@ webdeveloper는 도움을 많이 주셔서 감사합니다. 그것이 내가 필요한 것입니다. –