Skip to content Skip to sidebar Skip to footer

Filtering And Paging

Hi people thanks for the help. Im trying to implement a simple pagination that filter, hiding li's by class. The example is here. I'm new in this but with some help the main idea i

Solution 1:

I have updated your script: http://jsfiddle.net/vU9Hv/12/

Basically, I introduced a new variable visible which contained the selected li class to show. Then, the pagination function handles all the showing/hiding of lis. That variable is set to blank by default; thus, all lis will show initially. The pagination function will start with:

var totalItems = $("li" + visible).length;

and end with:

$("li" + visible).slice(min, max).show();

While the click handler is converted to:

$('div.filter').delegate('a', 'click', function (event) {
    visible = '.' + this.href.slice(this.href.indexOf("#") + 1);
    pagination();
    event.preventDefault();
});

Post a Comment for "Filtering And Paging"