JavaScript:
$.navigate = function() {
// a new link
if($anchor != document.location.hash){
// add a preloader
$("#content")
.empty()
.html('

');
// change the anchor saved for next time
$anchor = document.location.hash;
// get the variables ready for the get
var i = $anchor.substring(1).split("/");
var $page = i[0];
var $y = (i[1]) ? i[1] : false;
// get the file
$.get("callback.php", { x: $page, y: $y }, function(data){
$("#content")
.empty()
.html(data);
},"html");
}
};
$(function() {
var $anchor = "";
// change from the URI. This dont work.
if(document.location.hash){ $.navigate(); }
$("a","#nav")
.css({backgroundColor:"#f7f7f7"})
.each(function() {
$(this).attr("href","#" + $(this).attr("name"));
});
setInterval('$.navigate()', 300);
});
HTML:
Подробнее здесь: https://stackoverflow.com/questions/194 ... navigation