我刚刚进入jQuery Mobile - 热爱它,但现在已经达到了学习曲线。基本上我想要一些调用相同面板的页面。我有以下内容。大多数都有效。然而,每一个"推"在推动结束时面板内容贬低失败......无法理解原因。
page1.html
<?php
class example {
//protected $a;
//protected $c;
public function NumberInput($number){
$this->a = $number;
}
public function NumberOutput(){
return $this->a;
}
}
class example2 {
public function __construct(){
$this->mergingclass = new example;
}
public function numberInput2($number){
$this->c = $number;
}
public function NumberOutput2(){
return $this->c;
}
public function __call($method,$arguments){
echo "called methos is $method <br> ";
;
return $this->x = $arguments;
}
}
$b = new example2;
$b->NumberInput(7);
echo $b->NumberOutput();
?>
&#13;
调用panel.html ...
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script>
$(function(){
$("#includedContent").load("panel.html");
});
</script>
</head>
<body>
<div data-role="page" id="pageone">
<div data-role="panel" id="myPanel" data-display="push">
<div id="includedContent"></div>
</div>
<div data-role="header">
<h1>Page Header</h1>
</div>
<div data-role="main" class="ui-content">
<p>Click on the button below to open the Panel.</p>
<a href="#myPanel" class="ui-btn ui-btn-inline ui-corner-all ui-shadow">Open Panel</a>
</div>
<div data-role="footer">
<h1>Page Footer</h1>
</div>
</div>
</body>
</html>
&#13;
非常感谢您的评论 感谢
答案 0 :(得分:1)
为什么不使用外部面板:http://demos.jquerymobile.com/1.4.5/panel-external/
查看类似问题:jQuery mobile - Panels with multiple internal pages
如果您确实要加载外部html面板,则应使用每个页面的jQM pagecreate事件,并为每个页面上的每个面板指定唯一ID。此外,在加载完成时,您应该增强面板小部件。
$(document).on("pagecreate","#pageone", function(){
$("#includedContent").load( "panel.html", function() {
$(this).closest('[data-role="panel"]').enhanceWithin();
});
});