jquery - AJAX Loader doesn't stay untill the new content is loaded -


I am using AJAX functionality to load my WordPress pages in real time. I use the following approach to load it in real time

var toLoad = $ (this) .attr ('href') + '#container';
$ ('# container') .slideUp ('300', Load Content); $ $ ('# Load'). Remove (); $$ ('# wrapper') Attachment ('& lt; span id = "load"> LOADING ... & lt; / span & gt;'); $ $ ('# Load'). Feedine ('normal');
window.location.hash = $ (this) .attr ('href') .substr (0, $ (this) .attr ('href'). Length-5);
Function Load Dialog () {$ $ ('# Container'). Load (toload, '', showNewContent ())
} showNewContent () {$ $ ('# container'). Slidedown ('400', HiddenOlder ());
} Hide the looker () {
$ ('# load'). Fadeaut ('normal');
}
False Return;

I am facing a problem that is loading ... text is visible from half to second and the old content is again shown .. and then 4-5 After seconds, this content can only be loaded with the new old one until the content is fully loaded.

The question is not quite clear to me,

But,

  $ ('# container'). Load (toLoad, '', showNewContent ())   

  $ ('# container') should be changed LoadDown ('400', hideLoader), Load (Load, '', ShowNewContent)   

and,

  $ ('# container' ).   

to

  $ ('# container'). Slide Down ('400', HiddenOlder);   

We pass function references (we do not call them)

In addition, I do not think any FadeIn ('normal')

This is either . FadeIn ('slow') or . FadeIn ('fast')

In addition,

after this line

  $ ('# container'). SlideUp ('300', Load Content);   

Do not wait for the animation to complete. They are called instantly.

I think, you want them to be loadContent function

Comments