현재 jQuery Mobile "pagebeforecreate"페이지 초기화 이벤트를 사용하여 HTML 페이지에 컨텐츠를로드하고 있습니다. jQuery Mobile 이벤트는 여기에서 설명합니다 : http://jquerymobile.com/demos/1.0a2/#docs/api/events.html. 컨텐츠가 동 기적으로로드되고 본문에 추가 된 후 jQuery Mobile이 페이지를 포맷합니다. 여기 jQuery Mobile - 브라우저가 jQuery 모바일 이벤트를 지원하는지 확인하는 방법
는 jQuery를 모바일 지원하는 브라우저에서 '내 코드입니다 :<!DOCTYPE html>
<html>
<head>
<title>jQuery Mobile Test</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script>
$('body').live('pagebeforecreate',function(event){
var ajaxContent = "";
$.ajax({
async: false,
type: "GET",
url: "test.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('item').each(function()
{
ajaxContent += '<li><a href="'+$(this).find('link').text()+'">'+$(this).find('title').text()+'</a></li>';
});
//alert(ajaxContent);
$('#menu').append(ajaxContent);
}
});
});
</script>
<script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
</head>
<body>
<noscript>You must have JavaScript enabled to view the content on this website.</noscript>
<div data-role="page">
<div data-role="header">
<h1>jQuery Mobile</h1>
</div>
<div data-role="content">
<ul data-role="listview" id="menu">
<li><a href="#">Static</a></li>
</ul>
</div>
</div>
</body>
</html>
여기에 XML 파일입니다 브라우저가 "pagebeforecreate"를 지원하는 경우 내가 감지 할 수있는 방법
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<item>
<title>Awesome Link from XML 1</title>
<link>http://www.google.com</link>
</item>
<item>
<title>Awesome Link from XML 2</title>
<link>http://www.gmail.com</link>
</item>
</menu>
jQuery 모바일 이벤트? 아니면이 이벤트가 실행되었는지 감지하는 방법이 있습니까? 이 이벤트가 실행되지 않으면 XML을 다른 함수로로드해야합니다. IE 8은 jQuery Mobile을 지원하지 않지만 XML 파일을 처리하고 링크를 표시하는 것이 좋습니다.
고마워! 그건 잘된거야. "if (! $. mobile.gradeA())"를 테스트했으며 Internet Explorer 8에서 작동합니다. "$ .mobile.gradeA()"이벤트에 대한 설명서가 있습니까? jQuery Mobile 웹 사이트에서 아무 것도 볼 수 없었습니다. – Greg
이 페이지로 되돌아 오는 링크를 제공하여 신고해야합니다. –