4
我有一個網站與Ajax加載的內容。現在我想要實現jQuery address plugin以獲得更好的用戶體驗和搜索引擎優化爬行。幫助與jQuery地址插件
用這一行$.address.value($(this).attr('href'));
地址改變的東西有用,但我該如何做歷史支持,抓取等?我不得不這樣做,但是什麼?我試圖把$("#content").load(toLoad,'',showNewContent)
和其他一千件事情,其中不幸的是沒有結果。
的文檔是真窮:http://www.asual.com/jquery/address/docs/
這是我的代碼:
$('a:not([href^=http])').click(function() {
var toLoad = $(this).attr('href') + " #ajaxedContent";
$("#content").fadeOut(600,loadContent);
$("#load").remove();
$('#logo').append('<div id="load"></div>');
$("#load").fadeIn(100);
$.address.value($(this).attr('href'));
function loadContent() {
$("#content").load(toLoad,'',showNewContent)
}
function showNewContent() {
// Capture the final dimensions of the content element and animate, finally fade content in
$("#limit").animate({height: $("#content").height()},600,'easeInOutQuad',function() {
$("#content").fadeIn(600,hideLoader);
callback();
});
}
function hideLoader() {
$("#load").fadeOut(300);
}
return false;
});
的基本原理是這樣的:
$.address.change(function(event) {
// do something depending on the event.value property, e.g.
// $('#content').load(event.value + '.xml');
});
$('a').click(function() {
$.address.value($(this).attr('href'));
});
任何幫助將是非常讚賞。謝謝。
解決了!問題是,它無法識別頁面選擇。所以我改變了「$(this).attr('href')」與「event.path」。有用。 – Thomas 2010-09-19 23:46:22