jquery - Wordpress ajax pagination -
i'm using piece of code found tutorial enable ajax pagination on wordpress site. works find i'd enhance slightly.
at moment when click next page button there slight pause nothing happens. i'd display 1 of "waiting" type images (http://www.costacruises.co.uk/b2c/images/skin/default/gfx/ico_waiting.gif) unsure of how i'd this.
heres code i'm using.
jquery('#postpagination a').live('click', function(e){ e.preventdefault(); var link = jquery(this).attr('href'); jquery('#content-inner').fadeout(500).load(link + ' #content-inner', function(){ jquery('#content-inner').fadein(500); }); });
thanks
you need create "loading" element, position correctly css , set display:none. jquery's fadeout , fadein functions support specification of callbacks, change above code more this
jquery('#postpagination a').live('click', function(e){ e.preventdefault(); var link = jquery(this).attr('href'); jquery('#content-inner').fadeout(500, function(){ jquery("#spinner").show(); }).load(link + ' #content-inner', function(){ jquery('#content-inner').fadein(500, function(){ jquery("#spinner").hide(); }); }); });
changing "#spinner" id or class of loading element.
Comments
Post a Comment