jQTouch bind("pageAnimationEnd") when page is loaded dynamically

1.2k Views Asked by At

In jQTouch I am fetching a page dynamically from the server per the jQT demos per

<a href="/page" class="button">The Page</a>

It loads the HTML snippet into

<div id="page">

Normally I'd be able to do

$('#page').bind("pageAnimationEnd", ...)

to know when the page had finished loading, but it doesn't seem to work with dynamically loaded content. I've been trying to find a workaround but haven't been able to. I think that this question on SO is asking the same thing, but there didn't seem to be any conclusive answer.

2

There are 2 best solutions below

0
On

If you have access to the "page", just put the javascript on that page and it will be executed when it is done loading. So in the page html you could just add ...

<script>
    $(function() {
       do something when im finished
    });
</script>
0
On
$('#myid').live('pageAnimationStart', function(e, info){
         //do something
   }).bind('pageAnimationEnd', function(e, info){
                if (info.direction == 'in'){
                   //do something
                }
});