0

I allready have used to much time, figuring out (googling) how to make a butten, scroll down to a specific < li > in a edgetoedge list. I use JQtouch with Zepto and PhoneGap (Cordova) .

Here's my very simple example, where im trying to use html anchors. It'll not work:

<div id="ListPage">
 <div> <a href="#b">jump to b</a> </div>
  <div class="scroll">
 <ul>
  <li><a name="a" />Some text</li>
    .
    . 
  50 times li.... :)
    .
    .
  <li><a name="b" />Some text</li>
  .
    . 
  50 times li.... :)
    .
    .
  </ul>
 </div>
</div>

I cant use ID's cause JQtouch use the id and a for page transistions..

what to do...

Martin Lyder
  • 169
  • 2
  • 12

1 Answers1

1

This might help, it works for me in a separate scenario:

var pos = $("a[name=a]").position();
$('html, body').animate( { scrollTop: pos.top }, 'slow' );
dhaval
  • 7,611
  • 3
  • 29
  • 38
  • Im really a javascript rookie. I dont know how to implement the script. I tryed to place it in the head section, but then the scripts after it stop working (and still nothing happens pressing the button)... I have all my pages in one html file in Div's can i then use: ('html, body') ? – Martin Lyder Jun 30 '12 at 08:51
  • you need to put this script in the click event of your button, as you mentioned in your question above. if you can put actual source, i can show you where to put the script – dhaval Jun 30 '12 at 09:06
  • Thanks! I think this will work. But I have a lot of other isues I need to figure out before i can check this solved. – Martin Lyder Aug 16 '12 at 10:32