我有一个带有 Ajax 深度链接的测试 wordpress 博客。我想做的只是在ajax加载页面或帖子时设置一个新的标题。
通过锚标记属性标题或哈希 url 名称调用它。
任何帮助,将不胜感激。
http://missionandromeda.com/test/初始测试页面
$("body").append("<img src='loader.gif' id='ajax-loader' style='position: absolute; left: 50%; top: 64%;' />");
var base = 'http://missionandromeda.com/test',
$mainContent = $("#container"),
$ajaxSpinner = $("#ajax-loader"),
$allLinks = $("a"),
$('a:urlInternal').live('click', function(e) {
// Default action (go to link) prevented for comment-related links (which use onclick attributes)
e.preventDefault();
});
$.address.change(function(event) {
if (event.value) {
$ajaxSpinner.fadeIn();
$mainContent
.empty()
.load(base + event.value + ' #content', function() {
$ajaxSpinner.fadeOut();
$mainContent.fadeIn();
});
}
var current = location.protocol + '//' + location.hostname + location.pathname;
if (base + '/' != current) {
var diff = current.replace(base, '');
location = base + '/#' + diff;
}
});