document.addEventListener("deviceready", onReady, false);
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
※index.html <!DOCTYPE html> <html> <head> <title>My Page</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script> <script type="text/javascript" src="phonegap-1.4.1.js"></script> <script type="text/javascript"> function onLoad(){ document.addEventListener("deviceready", onReady, false); } function onReady() { navigator.compass.getCurrentHeading(onSuccess, onError); } function onSuccess(heading) { var heading = heading.trueHeading; document.getElementById('msg').innerHTML = "HEAD: " + heading; } function onError(compassError) { alert('Compass Error: ' + compassError.code); } </script> </head> <body onload="onLoad();"> <!-- home page --> <div id="home" data-role="page"> <div data-role="header"> <h1>Sample</h1> </div> <div data-role="content"> <h2>Sample Page</h2> <div id="msg"></div> </div> </div> </body> </html>
<< 前へ | 次へ >> |