온라인으로 $("ul.tabrow li").removeClass("active"); //Remove any "active" class
$(this).removeClass("active")
을 사용하도록 변경하면 대신 생각했던 것처럼 작동하지 않습니다.
코드가 지금 당장 어떻게 작동하는지, 위에서 언급 한 내용이 작동하지 않는 이유를 알고 싶습니다. 아래 라인 7에서 같은 셀렉터로 보이는 코드에 $(this)
을 사용합니다. 7의 코드는 다르지만 6 행은 다릅니다.
누구든지 설명 할 수 있습니까? $(this)
만 그들 모두는 현재 목록 항목에없는 참조하기 때문에
$("ul.tabrow li").bind({
click: function() {
return false;
},
mouseenter: function() {
$("ul.tabrow li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab-box").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
//$(activeTab).fadeIn(); //Fade in the active content
$(activeTab).show(); //Fade in the active content
return false;
}
});
가 – annonymously
는 잘 모르겠어요 '내가 생각했던대로 다음이 작동하지 않습니다'설명보다 일반적인 무언가를 사용할 수 있지만 chrome이나 firebug 같은 것을 사용하여'$ (this))'줄을 깨고 정확하게 가리키는 부분을 볼 수 있습니다 (지역 변수의 id 속성 참조). 이것은 li 대신 부모 요소로 보일 수 있습니다. –