Advertisement
RevelationTravis

Wordpress Multiple Loops Pagination Ajax

May 17th, 2014
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. *** content is wrapped in containers with ids of "cats" and "dogs"
  3. *** pagination is wrapped in containers with ids of "cats_pagination" and "dogs_pagination"
  4. */
  5. jQuery(function($) {
  6.     $('#cats').on('click', '#cats_pagination a', function(e){
  7.         e.preventDefault();
  8.         var link = $(this).attr('href');
  9.         $('#cats').fadeOut(500, function(){
  10.             $(this).load(link + ' #cats', function() {
  11.                 $(this).fadeIn(500);
  12.             });
  13.         });
  14.     });
  15.    
  16.     $('#dogs').on('click', '#dogs_pagination a', function(e){
  17.         e.preventDefault();
  18.         var link = $(this).attr('href');
  19.         $('#dogs').fadeOut(500, function(){
  20.             $(this).load(link + ' #dogs', function() {
  21.                 $(this).fadeIn(500);
  22.             });
  23.         });
  24.     });
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement