dimanche 4 janvier 2015

Run a JS function when HTML is rendered after page load and all AJAX requests have been made


Vote count:

-1




I bumped into a problem the other days and I tried a few solutions that proved not to be as good.


The problem:



  1. On my page I have HTML generated from the CMS, and a few AJAX requests that interact with the HTML (adding more content in some areas of the page).

  2. This page is long so when I am on other page and click to a link on this page it needs to go down to a certain area on the page; it will scroll me on page load, but after the scroll, some HTML still renders because of AJAX requests.

  3. The scrolling is made with spliting the URL and get the ID written in URL. Then scroll to that ID on page.

  4. I tried:

    • $(window).load(function() {});

    • $(document).ajaxStop(function() {}); and still not working ...



  5. So what I am trying to do is to wait until:

    • all AJAX requests are done and also;

    • the HTML generated to be loaded/rendered on page and after that to do the scroll to that area on the page.




Thank you in advance for your responses!



asked 1 min ago







Run a JS function when HTML is rendered after page load and all AJAX requests have been made

Aucun commentaire:

Enregistrer un commentaire