JQuery Mobile - 开放面板跳转到顶部

时间:2015-11-28 19:59:46

标签: jquery-mobile panel

当我向下滚动页面一点,然后点击打开面板按钮页面跳转到顶部。

HTML:

<div data-role="page">
<div data-role="panel" data-display="overlay" id="mypanel">
test panelu
</div>
<div data-role="header" role="banner" data-position="fixed">
<a href="#mypanel" class="ui-btn-left ui-btn ui-btn-inline ui-corner-all"><img id="menu-button" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/gfx/menu.svg"></a>
<h1><a id="header-logo" href="<?php echo $this->baseurl ?>/index.php?template=xxxx">Some name</a></h1>
</div>
<jdoc:include type="message" />
<jdoc:include type="component" />
</div>

1 个答案:

答案 0 :(得分:1)

在面板div行中添加data-position-fixed="true"

<div data-role="page">
<div data-role="panel" data-display="overlay" data-position-fixed="true" id="mypanel">
test panelu
</div>
<div data-role="header" role="banner" data-position="fixed">
<a href="#mypanel" class="ui-btn-left ui-btn ui-btn-inline ui-corner-all"><img id="menu-button" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/gfx/menu.svg"></a>
<h1><a id="header-logo" href="<?php echo $this->baseurl ?>/index.php?template=xxxx">Some name</a></h1>
</div>
<jdoc:include type="message" />
<jdoc:include type="component" />
</div>