更新时间:2023-12-03 10:08:28
$(function(){
var newHash = '',
$mainContent = $("#main-content");
$(".nav").delegate("a","click",function(){
window.location.hash = $(this).attr("href");
return false;
});
$(window).bind('hashchange',function(){
newHash = window.location.hash.substring(1);
if(newHash){
$mainContent.find("#guts").fadeOut('slow',function(){
$mainContent.hide().load(newHash + " #guts",function(){
$mainContent.fadeIn('slow');
});
});
}
});
$(window).trigger("hashchange");
});
这是我与ba-hashchange插件一起使用的
This what I am using with the ba-hashchange plugin
有关更多信息,请检查此 css-tricks.com/video-screencasts/85-best-practices-dynamic-content/
for more information check this css-tricks.com/video-screencasts/85-best-practices-dynamic-content/