0
$.mobile.loadPage('view-video');
不起作用,並且我有示例代碼下面。請幫我解決這個問題。
我收到警報「功能觸發」
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
</div>
<div data-role="main" class="ui-content">
<p>I Am Now A Mobile Developer!!</p>
<a href="javascript:void(0)" class="loadVideo">Load Video</a>
</div>
<div data-role="footer">
<h1>Footer Text</h1>
</div>
</div>
<div data-role="page" id="view-video">
<div data-role="main" class="ui-content">
Your Video Will be Here.
</div>
</div>
<script type="text/javascript">
$(document).on('click', '.loadVideo', function(e){
alert('Function Triggered');
$.mobile.loadPage('view-video');
});
</script>
</body>
</html>
現在我已將代碼更改爲$(「:mobile-pagecontainer」)。pagecontainer(「load」,「view-video.php」);仍然不工作 – rkaartikeyan
** view-video.php **是錯誤的,它必須是「頁面」的ID,所以沒有**。php ** =>編輯我的答案 – Michael
https://jsfiddle.net/ bnkb0fuk/2 /請看看 – rkaartikeyan