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 をロードしたいと思います。

次の2つのことを試しましたが、成功しませんでした。

$('.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 に答える