현재 사용하고있는 jQuery 스크립트에서 작지만 이상한 문제를 파악하려고합니다. 이, 실행하는 스크립트가 잘 작동하지만 작은 변화를 할 때 (아래의 HTML을 체크 아웃) 이하 나는 HTML로이 스크립트jQuery 중첩 클래스 선택기
(function($, undefined) {
$(document).ready(function() {
var $container = $(".update_content");
$container.find(".social_media_updates_extended_view").hide();
$container.delegate(".update_extend .btnFadeIn", "click", function(event) {
var $view = $(this).closest(".wrapper_update_extend").prev(".social_media_updates_extended_view").stop(true).fadeToggle(200);
$container.find(".social_media_updates_extended_view").not($view[0]).stop(true).fadeOut(200);
})
})
})(jQuery);
을 사용하고 http://jsfiddle.net/nRD4L/12/
: 현재 문제와 스크립트를 볼 수 있습니다 HTML strcuture의 변경으로 인해 작동하지 않습니다.
<div class="wrapper_update">
<div class="update_content">
<div class="social_media_updates_extended_view">
<p>Karel de Bruin</p>
</div>
<div class="wrapper_update_extend">
<div class="update_extend">
<span class="btnFadeIn">fade button span</span>
</div>
</div>
</div>
html로 위의 잘 작동하지만 지금은 DIV의 .wrapper_update_extend이 div.update_content 내에 있지 않기 때문에 HTML 아래 작동하지 않습니다.
<div class="wrapper_update">
<div class="update_content">
<div class="social_media_updates_extended_view">
<p>Karel de Bruin</p>
</div>
<p>content</p>
</div>
<div class="wrapper_update_extend">
<div class="update_extend">
<span class="btnFadeIn">fade button span</span>
</div>
</div>
는 그래서 클래스 .update_content witihin 클래스 .social_media_updates_extended_view을 찾을 수있는 스크립트를 조금 변경해야합니다.
누구나 팁이 있습니까?
건배! 몇 가지 변경 (어떤 요소를 표시/숨길 필요가 있는지 선택)을하고 완벽하게 작동합니다! 정말 오늘 밤 고칠 수있게 도와 줘서 고마워! –