jquery.address() を使用して、ajax を介してページをロードします。
$.address.state('').init(関数() {
// Initializes the plugin
$('#menu a').address();
$('#nextprev a').address();
}).change(function(event) {
// Loads the page content and inserts it into the content area
$.ajax({
url: $.address.state() + event.path,
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest.responseText);
},
success: function(data, textStatus, XMLHttpRequest) {
$('title').html($('title', data).html());
$.address.title(/>([^<]*)<\/title/.exec(data)[1]);
$('#content').html($('#content', data).html());
loadstuff();
startAnimation();
}
});
var startAnimation = function(data) {
... some animation going on here
});
現在、コードが ajax を呼び出して次のページをロードした後、次のページは startAnimation() を介して飛び込みます。それは今のところ本当にうまくいっています。
ただし、#nextprev 内に #next 要素と #prev 要素があります。それらのどれがクリックされたかを調べてから、別の関数 (つまり、startAnimation2()) をロードするアドレスが必要です。