URI无需重新加载即可更改?

他们是如何在主题中完成此function的,你点击uri更改的永久链接(眼球)按钮,没有哈希(#)这是怎么做到的? 它是ajax吗? 或者是其他东西。

我假设它正在调用页面但没有重新加载?

主题: http : //thingslog-theme.tumblr.com/ (点击每个post底部的眼球)

我很难过并帮忙吗?

他们使用这种代码:

$('a').click(function() { link = $(this).attr('href') history.pushState({}, '', link); $('#content').load('/content.php?url='+link) return false; }) 

使用历史pushstatefunction ,允许您添加和修改浏览器历史记录条目。

我们使用Backbone + HTML5 pushState来处理没有哈希的URI更改。 这是有效的,因为我们遵循Tumblr如何为所有博客构建其URL。

我们使用jQuery.load来处理获取html并将其加载到页面中。

该代码看起来有点像这样:

 $container.load('http://blog.tumblr.com/post/123 #container', function() { var $post = that.$('.overlay-container .post'); that.view = new App.PostViewFactory.createView($post); that.view.on('close', function() { window.history.back(); }); }); 

希望有所帮助。