iOS上仅打开一次listview的jquery面板
我正在使用jquery mobile 1.3.1,并在jquery面板中将列表元素动态附加到无序列表中。第一次打开面板时,一切正常,但当我关闭面板并再次尝试打开时,它不会显示。但是我仍然可以在屏幕上点击我知道列表元素在面板中的位置,然后做一些事情。面板只是没有显示。如果我点击列表元素,面板会在关闭和消失之前快速显示。如果我清空无序列表并再次附加列表元素,则面板将在我打开它时显示,但仅显示一次。然而,这只是iOS的问题,在android上它工作得非常完美。所以请帮忙,我不明白怎么了。这是我的密码:iOS上仅打开一次listview的jquery面板,jquery,ios,listview,jquery-mobile,panel,Jquery,Ios,Listview,Jquery Mobile,Panel,我正在使用jquery mobile 1.3.1,并在jquery面板中将列表元素动态附加到无序列表中。第一次打开面板时,一切正常,但当我关闭面板并再次尝试打开时,它不会显示。但是我仍然可以在屏幕上点击我知道列表元素在面板中的位置,然后做一些事情。面板只是没有显示。如果我点击列表元素,面板会在关闭和消失之前快速显示。如果我清空无序列表并再次附加列表元素,则面板将在我打开它时显示,但仅显示一次。然而,这只是iOS的问题,在android上它工作得非常完美。所以请帮忙,我不明白怎么了。这是我的密码:
<script type="text/javascript" src="jsScript/jquery-1.10.1.js"></script>
<script type="text/javascript" src="jsScript/jquery.mobile-1.3.1.js"></script>
<link rel="stylesheet" type="text/css" href="cssScript/jquery.mobile-1.4.0.css" />
<div id="mainMenu" style="display:none;" >
<!--Left Panel-->
<div data-role="panel" id="yourTurnPanel" data-display="overlay" data-theme="a">
<div>
<div>
<div class="navbar-header" id="yourTurnDiv">
<h4 style="text-align:center;">Your Turn</h4>
</div>
<ul id="yourTurnList" data-role="listview" >
</ul>
</div><!--/nav_name-->
</div><!--/nav_profile-->
</div><!-- /panel -->
</div>
轮到你了
这里我清空并附加列表
var makeList = function(){
$('#yourTurnList').empty();
$('#yourTurnList').append('<li data-rel="close" data-icon="false" data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-iconpos="right" class="ui-btn"><img src="'+picURL+'" class="ui-li-thumb ui-corner-tl"/> <div> Player <br> Round</div></li>');
}
// the method that opens the panel
$("#yourTurn").click(function() {
$("#yourTurnPanel").panel("open" , null); // works only once after appending the list elements
});
var makeList=function(){
$(“#您的名单”).empty();
$('yourTurnList')。追加('li data rel=“close”data icon=“false”data corners=“false”data shadow=“false”data iconshadow=“true”data wrappers=“div”data iconpos=“right”class=“ui btn”>Player
Round);
}
//打开面板的方法
$(“#轮到你了”)。单击(函数(){
$(“#yourTurnPanel”).panel(“open”,null);//在附加列表元素后仅工作一次
});
对不起,代码太难看了 我修复了我的问题,在列表中添加了一个列表元素,并在0.4秒后将其删除。然后,即使在iphone上,一切都很好。这是一个快速修复,但它的工作 你能做一把小提琴来重现这个问题吗?我认为这是不可能的,因为它在除iphone之外的所有设备上都能正常工作……你可以在iphone上访问JSFIDLE。因此,制作一把小提琴,在iphone上导航到它,如果它显示出问题,在你的问题中发布小提琴。我做了一个快速修复,添加了一个新的列表元素,并在0.4秒后将其删除。这让我的面板再次打开…:P