简体   繁体   English

加载AJAX页面时,jQTouch执行代码

[英]jQTouch execute code when AJAX page is loaded

When the content is static: 当内容为静态时:

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

When the content is AJAX: 当内容为AJAX时:

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

How do I bind something to occur after the AJAX (page.html) is loaded? 如何绑定AJAX(page.html)加载后发生的事情?

这个问题与jqtouch有关,它从常规锚标记发出AJAX请求

Take a look at the demo , in particular the "GET Example" under AJAX section. 看一下演示 ,特别是AJAX部分下的“ GET Example”。 Essentially, you want to have the anchor element to link to a page which returns a "jQTouch page", ie <div id="pageID">...</div> . 本质上,您希望锚元素链接到返回“ jQTouch页面”的页面,即<div id="pageID">...</div>

So, in your case, you may have this anchor: 因此,就您而言,您可能具有以下锚点:

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

And the page.html may be something like: 而且page.html可能类似于:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM