Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The last parameter in this function:</p> <pre><code>$("#loading").animate({ 'height': loaderHeight + "px" }, 900, function () { }); </code></pre> <p>Is the 'complete' function. This function is called when the animation is complete.</p> <p>So, you can do something in this function when it's complete, like so:</p> <pre><code>$("#loading").animate({ 'height': loaderHeight + "px" }, 900, function () { alert('animations complete!'); }); </code></pre> <p><strong>----Edit----</strong></p> <p>Based on your edits, you probably want to do something like this.</p> <ol> <li><p>Have a variable that will let you know when both are finished:</p> <pre><code>var signal = 0; </code></pre></li> <li><p>Have a function to change your content with this in it:</p> <pre><code>function changeContent() { signal++; if (signal === 2) { // change the content code here signal = 0; } } </code></pre></li> <li><p>When the animation is finished, call:</p> <pre><code>changeContent(); </code></pre></li> <li><p>When you've grabbed the data, call:</p> <pre><code>changeContent(); </code></pre></li> </ol> <p>When <code>changeContent()</code> is called the first time by either function, it will increment <code>signal</code> to 1 and exit the function. Then on the second time, it will increment <code>signal</code> to 2. Since <code>signal === 2</code>, you know that both the animation and grabbing the data is complete, so you can now change your content.</p> <p>The good part about using an integer to do this, is if you want to have 3, 4, 5+ functions finish working before changing your content. In this case you just have to change the condition by increasing the number in <code>if (signal === 2)</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload