1

我正在使用演示中提供的 AJAX 示例使用 JQTOUCH:

$('#customers').bind('pageAnimationEnd', function(e, info){
    if (!$(this).data('loaded')) {                      // Make sure the data hasn't already been loaded (we'll set 'loaded' to true a couple lines further down)
        $('.loadingscreen').css({'display':'block'});
        $(this).append($('<div> </div>').         // Append a placeholder in case the remote HTML takes its sweet time making it back
            load('/mobile/ajax/customers/ .info', function() {        // Overwrite the "Loading" placeholder text with the remote HTML
                $(this).parent().data('loaded', true);  // Set the 'loaded' var to true so we know not to re-load the HTML next time the #callback div animation ends
                $('.loadingscreen').css({'display':'none'});
            }));
    }
});

然后这会返回一个很好的 UL,它的输出很好..

<ul class="edgetoedge">
 <li class="viewaction" id="715">
  <span class="Title"><a href="/c-view/715/">Lorem Ipsum is simply dummy text of the...</a></span>
  <div class="meta">
  <span class="dateAdded"> 1d ago </span>
  </div>
 </li>
</ul>

这就是我卡住的地方。那么,当您单击上面的链接时,我该如何做到这一点,它会加载包装在 class="Title" 附近的 URL?

我希望它像第一个代码示例一样加载 JQTouch。

我尝试了以下两件事但没有成功:

$('.viewaction').bind('click', function() {
  alert('wow');
});

$('.viewaction').live('pageAnimationEnd', function(e, info){

});

谢谢!

4

1 回答 1

2

把这个放在你的第一个绑定函数之外的某个地方

$("span[class=Title]").delegate("a", "click", function(){
    alert('LOLCAT');
});
于 2010-04-09T04:56:54.387 回答