0
i는 사용자가 모바일 장치의 방위를 변경할 때 무언가를 간단한 예를 :이 예 다운로드 문서 JQuery와 모바일
<script>
$(document).on("orientationchange", function(event) {
if (event.orientation === "landscape") {
// We have changed to landscape orientation, so we have more room
// Make the headers and footers longer!
$("header h1").text("jQuery Mobile Demonstration Application")
$("footer h3").text("O'Reilly Multimedia Services")
} else {
// Back in portrait orientation, so return header and footer to original length.
$("header h1").text("jQuery Mobile")
$("footer h3").text("O'Reilly")
}
})
</script>
(실시 예 3) 토륨 지금
public class MainActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/example-3.html");
}
}
: O'Reilly Webcast: The jQuery Mobile API In-Depth
http://www.youtube.com/watch?v=I6Y4a0hA8tI
대한 소스 코드 https://github.com/jreid01/jqm-api
에서 난 폰갭이 예로드 예가 내 넥서스 1이나 안드로이드 에뮬레이터에서 더 이상 작동하지 않습니다. 몇 가지 실험을 한 후에,이 예제는 내가 document
을 window
으로 변경했을 때 작동했습니다. document
개체가 작동하지 않는 이유는 무엇입니까? 내가 누락 된 개념은 무엇입니까?
감사합니다.
deviceready 이벤트를 기다리고 계십니까? –
아니요. jquery \ mobile 스크립트 외의 유일한 스크립트는 게시물에 붙여 넣은 것입니다. –
이 경우에는 http://docs.phonegap.com/en/2.1.0/을 읽어야합니다. cordova_events_events.md.html # deviceready –