jQuery Mobile page jumping to top when a collapsible is clicked

后端 未结 3 1681
温柔的废话
温柔的废话 2021-01-14 00:18

I have a jQuery Mobile page with a panel navigation. The last two elements are collapsibles with further menu items. Expanding or collapsing these causes the page to jump to

3条回答
  •  轮回少年
    2021-01-14 01:18

    Please add return false; as a final return in each onclick call.

    For example:

    onclick="ajax_content('impressum'); return false;"
    

    And finally, instead of doing

    return ajax_content('settings/profile_pic');
    

    Just call ajax_content without return, add a return false after, and move your logic (what return is supposed to do) inside your ajax_content block.

提交回复
热议问题