
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 1.31 KB | hits: 13 | expires: Never
Change content with Jquery (Paginate)
<div class="pagination">
<a href="test.php">clik2</a>
</div>
var hash = window.location.hash.substr(1);
var href = $('.pagination a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html #content';
$('#content').load(toLoad)
}
});
$('.pagination a').click(function(){
var toLoad = $(this).attr('href')+' #content';
$('#content').hide('1000',loadContent);
$('#load').remove();
$('#wrapper').append('<span id="load"></span>');
$('#load').fadeIn('slow');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').delay(100).show('fast',hideLoader());
$(window).scrollTop('');
}
function hideLoader() {
$('#load').delay(300).fadeOut('fast');
}
return false;
});
});
$('.pagination a').click(
$('.pagination a').live('click',function() {