0
정상적인 페이지를 다시로드하는 대신 내 wordpress 내부 링크를 콘텐츠 div에 표시하려고합니다. 페이드 인/아웃은 올바르게 작동하지만 div 콘텐츠는 변경되지 않습니다. Firebug는 오류를 표시하지 않으며 모든 내부 링크는 이제 페이지 링크에 "# /"만 추가합니다. 링크가 올바르게 jquery로 다시 추가되는지 어떻게 확인할 수 있습니까? 사전에 감사합니다,jquery links 페이드 인/아웃
PS, 나는 다음과 같은 오전 :
$(function() {
$(".home li.home").removeClass("home").addClass("current_page_item");
var $mainContent = $("#content"),
URL = '',
siteURL = "http://" + top.location.host.toString(),
$internalLinks = $("a[href^='"+siteURL+"']"),
hash = window.location.hash,
$el, $allLinks = $("a");
if (hash) {
$mainContent.animate({ opacity: "0.1" });
$(".current_page_item").removeClass("current_page_item");
$("a[href="+hash+"]").addClass("current_link").parent().addClass("current_page_item");
hash = hash.substring(1);
URL = hash + " #content";
$mainContent.load(URL, function() {
$mainContent.animate({ opacity: "1" });
});
}
$internalLinks.each(function() {
$(this).attr("href", "#" + this.pathname);
}).click(function() {
$mainContent.animate({ opacity: "0.1" });
$el = $(this);
$(".current_page_item").removeClass("current_page_item");
$allLinks.removeClass("current_link");
URL = $el.attr("href").substring(1);
URL = URL + " #content";
$mainContent.load(URL, function() {
$el.addClass("current_link").parent().addClass("current_page_item");
$mainContent.animate({ opacity: "1" });
});
});
});
'this.pathname'을 출력하려고 했습니까? 왜냐하면 저는 이것이 정의되지 않았 음을 확신합니다. 따라서 왜 '#'만이 링크로 끝나는 지 설명합니다. – Kevin
jquery에 포함 시키면 Pathname is not가 나타나거나 var pathname = window.location.pathname을 사용해야합니까? – Gordonzo
이것은 jQuery에 포함되어 있지 않습니다. 당신은'window.location.href'을 사용해야합니다. 그러면 현재 페이지의 주소가 반환됩니다. – Kevin