加载AJAX页面时jQTouch执行代码

问题描述:

当内容为静态时:

<a href="#nearme">Click</a>
<script>$('#nearme').bind('pageAnimationEnd', function(event, info){});</script>

当内容为AJAX时:

<a href="page.html">Click</a>

如何在加载AJAX(page.html)后绑定某些内容?

How do I bind something to occur after the AJAX (page.html) is loaded?

看看 demo ,特别是AJAX部分下的GET Example。基本上,您希望将anchor元素链接到返回jQTouch页面的页面,即< div id =pageID> ...< / div>

Take a look at the demo, in particular the "GET Example" under AJAX section. Essentially, you want to have the anchor element to link to a page which returns a "jQTouch page", i.e. <div id="pageID">...</div>.

所以,在你的情况下,你可能有这个锚:

So, in your case, you may have this anchor:

<a href="page.html" class="slide">Click</a>

page.html 可能是某种东西喜欢:

And the page.html may be something like:

<div id="ajaxPage">
  <div class="toolbar"><h1>Title</h1></div>
  <div>
    <ul>
      <li>item 1</li>
      <li>item 1</li>
    </ul>
  </div>
</div>