转换到同一页面后,JQueryMobile 1.4弹出窗口无法打开

时间:2014-01-16 14:49:35

标签: javascript jquery jquery-mobile

我有一个带有data-role =“listview”的页面data-split-icon =“gear”

该页面名为sorting.php

每个列表项中的主链接是例如sorting.php?parent = 1

齿轮图标(拆分图标)打开#popup,这是一个data-role =“popup”id =“popup”

我的问题是第一次打开sorting.php时弹出窗口打开正确,但是点击列表项后转换到sorting.php?parent = 1,弹出窗口没有打开。

当我点击齿轮图标时,浏览器中的URL栏只显示“sorting.php?parent = 1#& ui-state = dialog”,但没有任何反应。有想法该怎么解决这个吗?

这是我的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>P1</title>

<link rel="stylesheet" href="res/lib/jquery.mobile-1.4.0.min.css">
<link rel="stylesheet" href="custom.css">

<script src="res/lib/jquery-1.10.2.min.js"></script>
<script> $(document).on("mobileinit", function () { $.mobile.changePage.defaults.changeHash = false; }); </script>
<script src="res/lib/jquery.mobile-1.4.0.min.js"></script>

</head>

<body>

<div data-role="page" id="pagetwo" data-overlay-theme="e">

<div data-role="popup" id="popup">
<ul data-role="listview" data-count-theme="c" data-inset="true">
    <li class="custom-li">
        <div data-role="collapsible" class="custom-collapsible" data-iconpos="right">
            <h3>Editar</h3> 
            <p>Formulario</p>
        </div>
    </li>
    <li class="custom-bottom-li"><a href="#">Eliminar</a></li>
    <li><a href="#">Crear Hijo</a></li>
</ul>
</div>
<div data-role="header" data-theme="b"><h1>P1</h1></div>
<div data-role="content" data-theme="a">
<ul data-role="listview" data-split-icon="gear" data-split-theme="a" data-inset="true">

<?php
require_once("res/mysql/mysql-connect.php");
if(isset($_GET["parent"])) 
    $where = " WHERE sorting_parent_id =". $_GET["parent"];
else
    $where = " WHERE sorting_parent_id =0";

if ($res_sorting_padres = $mysqli->query("SELECT * FROM sorting".$where)) 
{
    while ($fila = $res_sorting_padres->fetch_assoc()) 
    {
        $r1 = $mysqli->query("SELECT count(sorting_id) from sorting where sorting_parent_id =".$fila['sorting_id']);
        $cuenta = $r1->fetch_row();
        $enlace = '';
        if ($cuenta[0] > 0) $enlace = "sorting.php?parent=".$fila['sorting_id'];
        echo '<li><a href="'.$enlace.'"><p>'.$fila['sorting_description'].'</p><span class="ui-li-count">'.$cuenta[0].'</span></a>';
        echo '<a href="#popup" data-rel="popup" data-position-to="window" data-transition="fade">Opciones</a></li>';
    }
    $res_sorting_padres->close();   
}
else
{
        printf("Errormessage: %s\n", $mysqli->error);
}
?>
</ul>
</div>  
<div data-role="footer" data-theme="c"><h1>Footer Text</h1></div>
</div>
</body>
</html>

0 个答案:

没有答案