当我单击导航菜单项时,我的页面将加载并动画,当我尝试使用后退和前进箭头时,我的页面将加载并转到该特定页面,但我的任何内容都没有动画。
有什么想法吗?
代码在这里
var History = window.History; // Note: We are using a capital H instead of a lower h
if (!History.enabled) {
// History.js is disabled for this browser.
// This is because we can optionally choose to support HTML4 browsers or not.
return false;
}
// Bind to StateChange Event
History.Adapter.bind(window, 'statechange', function() { // Note: We are using statechange instead of popstate
var State = History.getState();
$('#content').animate({opacity: "0"}).load(State.url + '#content', function() {
$('#content').animate({opacity: "1"});
});
});
$('.nav-tabs li a').click(function (evt) {
History.pushState(null, $(this).text(), $(this).attr('href'));
});
任何想法都会很棒!