1
我想加载我的下一个/以前的帖子与ajax链接。我写了这段代码,它运作良好。但是,当用户单击“返回”按钮时,地址栏中的位置不会更新。添加历史记录支持我的ajax脚本
$(".next a").live("click", function(e){
e.preventDefault();
$("#portfolio_item").load(jQuery(this).attr("href") + " #portfolio_item");
$("#portfolio_item").animate({marginLeft:'98%'});
$("#portfolio_item").animate({marginLeft:'0px'});
$("#right_content, #gallery").fadeOut().delay(1000).fadeIn();
return false;
});
我读过有关像“jQuery的地址”和“烧烤”的插件,但我怎样才能将它们应用到我的代码?希望得到帮助!
感谢您的回答!我也见过这个插件,我怎么偶然发现这个插件:http://www.serpere.info/jquery-history-plugin/samples/ajax/。我有它的工作,只有位置显示错误:http://websites.nl/portfolio/#/http://websites.nl/portfolio/item1。任何想法如何在不破坏功能的情况下改变这种状况? – 2012-01-17 14:23:12
我想你希望你的网址在#/后只有item1。当你传递你的新网址时,你是在放置“item1”还是“/ item1”?这可能是问题(我从来没有使用过你的插件)。 – Alex 2012-01-17 17:22:45