간 데모 :https://tornhq.com/WorkingOn/InteractiveMap/Replaced-With-Divs.html깨진 jQuery를 탭 스위처
jQuery를 탭 스위치 코드무시 라인 2-6
$(function() {
$("#clickme").toggle(function() {
$(this).parent().animate({right:'-300px'}, {queue: false, duration: 500});
}, function() {
$(this).parent().animate({right:'-0px'}, {queue: false, duration: 500});
});
$('#tab-content div').hide();
$('#tab-content div:last').show();
$('#Info-Side-Tabs li').click(function() {
$('#Info-Side-Tabs li').removeClass("current");
$(this).find('li').addClass("current");
$('#tab-content div').hide();
var indexer = $(this).index(); //gets the current index of (this) which is #nav li
$('#tab-content div:eq(' + indexer + ')').fadeIn(); //uses whatever index the link has to open the corresponding box
});
});
나는 문제가 내 웹 사이트로 jQuery를 탭 스위치를 구현하는 데 문제 :
"$(this).find('li').addClass("current");"
'a'를 찾으려고하지만, 나는 그것을 li의 클래스가 아니라 a의 클래스를 변경해야합니다.
표시되는 탭 스위치 콘텐츠는 상단의 두 번째 부분이며 일부는 전부가 아닙니다. 나는이 순간에 매우 혼란스러워서 정말로 도움이 될 수 있습니다.
업데이트 :
$('#Info-Side-Tabs li').removeClass("current");
Seems to be removing the class upon clicking, however
$(this).find('li').addClass("current");
Does not seem to add the class to the new clicked tab.
$("#tab-3").toggle(function() {
// $('#Map-Selection-Info').animate({right:'-976px'}, {queue: false, duration: 500});
$('#Map-Selection-Info').animate({marginLeft: '976px'}, 1000).addClass('current');
}, function() {
$('#Map-Selection-Info').animate({right:'670px'}, {queue: false, duration: 500});
});
I am trying to apply the above to the 'Hide This' tab, so when you click on it, it move further right out of view and recliick to show.
Full Script So Far:
$(function() {
$("#tab-3").toggle(function() {
// $('#Map-Selection-Info').animate({right:'-976px'}, {queue: false, duration: 500});
$('#Map-Selection-Info').animate({marginLeft: '976px'}, 1000).addClass('current');
}, function() {
$('#Map-Selection-Info').animate({right:'670px'}, {queue: false, duration: 500});
});
$('#tab-content div').hide();
$('#tab-content div:last').show();
$('#Info-Side-Tabs li').click(function() {
$('#Info-Side-Tabs li').removeClass("current");
$(this).find('li').addClass("current");
$('#tab-content div').hide();
var href = $(this).find('a').attr("href");
$('#tab-content div' + href).fadeIn().find('*').show();
});
});
내 편집을 확인, 당신은 여전히 최신 일부 변경 사항이 없습니다. 또한 tab-3의 id를 가진 요소가 없으므로 토글 기능이 작동하지 않습니다! li 요소에 tab-3의 id를 부여해야합니다. –
@Aydin Hassan 나는 이제 탭 3의 ID를주었습니다. 그러나 아직 움직임이 없습니다. 나는 당신이 말한 것을 지났고, 정확하게 잘못하고있는 것을 해결할 수는 없습니다. 라이브 버전이 업데이트되었습니다. 감사합니다. Tim –
@Aydin Hassan 방금 전 뭘했는지 모르겠지만 지금은 거의 제대로 작동하고 있습니다.내 '오버플로 : 숨김; 작동하지 않고 # tab-3 탭을 전환하지 않으려합니다. –