jQuery pagination callback
$("#News-Pagination").pagination(122, {
items_per_page:20,
callback:handlePaginationClick
});
Using this, but on page load handlePaginationClick
callback function is called each time au开发者_开发技巧tomatically.
I want that to be only called when user clicks on pagination numbers.
Just don't do anything the first time around:
var afterAnnoyingOnLoad = false;
$("#News-Pagination").pagination(122, {
items_per_page:20,
callback: function () {
if (afterAnnoyingOnLoad) handlePaginationClick();
else afterAnnoyingOnLoad = true;
}
});
...
var isLoading = true;
$("#News-Pagination").pagination(122, {
items_per_page:20,
callback:handlePaginationClick
});
...
function handlePaginationClick(new_page_index, pagination_container) {
if(isLoading){
isLoading = false;
return false; // avoid running this function on page load
}
...
...
}
精彩评论