jquery移动外部面板无法正常打开

时间:2015-08-19 19:30:00

标签: jquery-mobile panel

我正在尝试使用jquery移动面板。目前,当面板打开时,它会一直滑动覆盖我的页面,而不仅仅是部分方式。我认为它必须与面板的初始化有关。

有什么想法吗?

以下是jsfiddle

HTML

<div id="panel_home" data-role="panel"  data-position="right" data-display="slide" data-theme="a">
<ul  data-role="listview">
    <li>Panel Button 1</li>
    <li>Panel Button 2</li>
    <li>Panel Button 3</li>
</ul>
</div>

<div data-role="page" id="page_home">

<div data-role="header" data-position="fixed" >
    <a  href="#panel_home" > <img border="0"
           src="http://cdn-img.easyicon.net/png/11464/1146409.gif"
           width="30" height="30">
    </a>
</div>


<div data-role="content" >
    <h2>Page Content</h2>
</div>


<div data-role="footer" data-position="fixed">
    <h2>Footer Content</h2>
</div>
</div>

JS

$(document).one('mobileinit', function () {
   $("[data-role=panel]").panel().enhanceWithin();
});

1 个答案:

答案 0 :(得分:0)

应在Jquery的document.ready上初始化外部面板:

$( document ).ready(function() {
    $("[data-role=panel]").panel().enhanceWithin();
});
  

更新了 FIDDLE

相关问题