JqTouch - Detect trigger for animation

Posted by majman on Stack Overflow See other posts from Stack Overflow or by majman
Published on 2010-03-04T19:36:32Z Indexed on 2010/04/19 20:03 UTC
Read the original article Hit count: 370

Filed under:
|
|

Yet another problem I'm having w/ jqTouch... I'm trying to detect what element was clicked to trigger an animation so that I can pass parameters from the clicked item to the subsequent page.

My HTML is:

<div id="places">
 <div class="toolbar">
        <h1>Places</h1>
  <a class="back" href="#">Back</a>
    </div>
 <ul>
  <li id="1"><a href="#singleplace">Place 1</a></li>
  <li id="2"><a href="#singleplace">Place 2</a></li>
  <li id="3"><a href="#singleplace">Place 3</a></li>
 </ul>
</div>

<div id="singleplace">
 <div class="toolbar">
        <h1></h1>
  <a class="back" href="#">Back</a>
    </div>
</div>

When I click on any of the list items in #places, I'm able to slide over to #singleplace just fine, but I'm trying to detect which element was clicked so that I can pass parameters into the #singleplace div. My javascript is:

var placeID;
$('#places a').live('mouseup',function(){
 $('#singleplace h1').html($(this).text())
 placeID = $(this).parent().attr('id');
})

I've tried several alternatives to the $(el).live('event', fn()) approach including:

$('#places a').live('click',fn()...
$('#places a').live('mouseup',fn()...
$('#places a').live('tap',fn()...
$('#places a').tap(fn()...

None of which seem to work. Is there a better way I could be handling this? I noticed on jqTouch's issues page, there is this: http://code.google.com/p/jqtouch/issues/detail?id=91 which may be part of the problem...

© Stack Overflow or respective owner

Related posts about jqtouch

Related posts about jQuery