일부 jQuery 코드를 사용하여 페이지의 내용이 분할되어 (탭 블록의 상단에서 탐색 가능) 탭을 만들 때 "다음 "또는"이전 "(각 탭의 콘텐츠 하단에 위치) 링크를 클릭 :jQuery에서 setTimeout을 사용하여 함수를 정렬하는 데 문제가 있음
- 페이지가 탭 블록의 상단 (성공적으로 사용하여 구현까지 스크롤"750ms 을 통해 .scrollTo "플러그인)
- 일단 스크롤하면 탭이 해당 "이전"또는 "다음"탭 (해시 태그 URL로 식별)으로 변경됩니다. - 250ms 후.
다음 코드를 사용 :
$(".external_link").click(function() {
$.scrollTo(515, 750, {easing:'easeInOutQuad'});
setTimeout(changeTab($(this).attr("href")), 1000);
return false;
});
두 미주리에서 동시에 일어난다. 누군가 내가 잘못하고있는 것에 대해 밝힐 수 있다면 정말 감사 할 것입니다. 전체에서
코드 :
$(document).ready(function() {
$(".tab_content").hide();
$("ul.content_tabs li:first").addClass("active").show();
$(".tab_content:first").show();
$('.content_tabs li').each(function(i) {
var thisId = $(this).find("a").attr("href");
thisId = thisId.substring(1,thisId.length) + '_top';
$(this).attr("id",thisId);
});
function changeTab(activeTab) {
$("ul.content_tabs li").removeClass("active");
$(activeTab + '_top').addClass("active");
$(".tab_content").hide();
$(activeTab).fadeIn();
}
//check to see if a tab is called onload
if (location.hash!=""){changeTab(location.hash);}
//if you call the page and want to show a tab other than the first, for instance index.html#tab4
$("ul.content_tabs li").click(function() {
if ($(this).hasClass("active"))
return false;
changeTab($(this).find("a").attr("href"));
return false;
});
$(".external_link").click(function() {
$.scrollTo(515, 750, {easing:'easeInOutQuad'});
setTimeout(changeTab($(this).attr("href")), 1000);
return false;
});
});
난 지금의 setTimeout이 작업을 수행하려고 시도하는 건가요? 내 지식은 엄청나게 제한되어 있습니다.
Perfect! 정말 고맙습니다! :) –