블로그를 통해 "ajax"라는 훌륭한 튜토리얼을 따라갔습니다 : http://www.deluxeblogtips.com/2010/05/how-to-ajaxify-wordpress-theme.html 그러나 문제는 아약스가 생성하는 해시에 있다고 생각합니다. . 콘텐츠가로드 된 후 어떻게 URL에서 해시를 제거 할 수 있습니까? 여기에 내 코드를 복사 :Ajax 로딩 후 해쉬 제거 (저는 AJAXING WordPress 8-입니다.)
jQuery(document).ready(function($) {
var $mainContent = $("#content"),
siteUrl = "http://" + top.location.host.toString(),
url = '';
$(document).delegate("a[href^='"+siteUrl+"']:not([href*=/wp-admin/]):not([href*=/wp-login.php]):not([href$=/feed/]):not([href*=/go.php]):not(.comment-reply-link)", "click", function() {
location.hash = this.pathname;
$('html, body').animate({scrollTop:0}, 'fast');
return false;
});
$("#searchform").submit(function(e) {
location.hash = '?s=' + $("#search").val();
e.preventDefault();
});
$(window).bind('hashchange', function(){
url = window.location.hash.substring(1);
if (!url) {
return;
}
url = url + " #inside";
$mainContent.html('<div id="loader">Caricamento in corso...</div>').load(url, function() {
//$mainContent.animate({opacity: "1"});
scriptss();
});
});
$(window).trigger('hashchange');
});
대단히 감사합니다!
안녕하세요. 알베르토입니다. 답변이 도움이 될 경우 투표를 통해 '수락'으로 표시 할 수 있습니다. '답변'섹션은 '감사합니다'섹션에 적합하지 않습니다. – artlung
감사합니다. 알베르토! StackOverflow를 즐기시 길 바랍니다! – artlung