How do I prevent page loading on link click for an intra page link?

How do I prevent page loading on link click for an intra page link?

Hello Everybody!

I'm trying to "mobilize" an existing website using jquery mobile. This basicly works but (for now) one problem left:

For long pages there are lots of anchors and links to this anchors defined which are hijacked by jqm and prevented from navigating within the page. Instead the link is interpreted as a navigation to another page.

I've learned from another post here that the following code enables a scroll the the anchor when clicking on the intrapage link:

  1. <link rel="stylesheet" href="css/jquery-mobile/jquery.mobile-1.0a3.min.css">
    <script type="text/javascript" src="js/jquery-1.5.min.js"></script>
    <script language="javascript">
          $(document).bind("mobileinit",function(){
                $('a.intrapagenav').live('click', function(ev) {
                      var target = $( $(this).attr('href') ).get(0).offsetTop;
                      $.mobile.silentScroll(target);
                      ev.preventDefault();
                      return false;
                });
          });               
    </script>
    <script type="text/javascript" src="js/jquery.mobile-1.0a3.min.js"></script>















This works partially as expected. The page is scrolled to the anchor, but after the scroll is done a page navigation occurs and of course fails.

So how do I prevent the page navigation?

Any help is highly appreciated.

Best regards....