Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop"...

30
Method, Event, Layout API

Transcript of Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop"...

Page 1: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

Method, Event, Layout API

Page 2: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

$.mobile.changePage

//transition to the "confirm" page with a "pop" transition without tracking it in history

$.mobile.changePage( "../alerts/confirm.html",{

transition: "pop", reverse: false, changeHash: false

});

Page 3: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

$.mobile.loadPage

//load a "search results" page, using data from a form with an ID of "search"

$.mobile.loadPage( "searchresults.php", { type: "post", data: $("form#search").serialize()

});

Page 4: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

$.mobile.showPageLoadingMsg//use theme swatch "b", a custom message, and no spinner

$.mobile.showPageLoadingMsg("b", "This is only a test", true);

Page 5: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

$.mobile.hidePageLoadingMsg//hide the page loader

$.mobile.hidePageLoadingMsg();

Page 6: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

$.mobile.silentScroll

//scroll to Y 100px

$.mobile.silentScroll(100);

Page 7: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

Event

tap taphold swip swipleft swipright

Page 8: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

swipe 이벤트 페이지 전환$(":jqmData(role='page')").live("swipeleft",function(){

// 현재 페이지의 id 에서 페이지 번호를 알아낸 다음 1 을 더합니다 .

var nextPage = parseInt($(this).attr("id").split("page")[1])+1;if(nextPage===4) nextPage=1;// 페이지를 전환합니다 .$.mobile.changePage("#page"+nextPage,"slide");

});$(":jqmData(role='page')").live("swiperight",function(){

// 현재 페이지의 id 에서 페이지 번호를 알아낸 다음 1 을 뺍니다 .var nextPage = parseInt($(this).attr("id").split("page")[1])-1;if(nextPage===0)nextPage=3;// 페이지를 전환합니다 .$.mobile.changePage("#page"+nextPage,

{transition:"slide",reverse:true});})

Page 9: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

초기화 이벤트 pagebeforecreate pagecreate

페이지 보이기 숨기기 이벤트

pagebeforehide pagebeforeshow pagehide pageshow

Page 10: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

방향 전환 Event

$(window).bind('orientationchange',function(event){

if (event.orientation == "portrait") {// 세로

} else if (event.orientation == "landscape") { // 가로

}});

Page 11: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

가상 마우스 Event

vmouseover == touch vmousedown == touchstart vmousemove == touchmove vmouseup == touchend vclick == touchend vmousecancel == touchcancel

Page 12: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

반응형 Layout Event

css 선택자 ( .portrait, .landscape ) 방향 전환 이벤트 (orientationchange)

Page 13: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

화면크기 중단점 클래스 320px, 480px, 768px, 1024px 중단점 추가

$.mobile.addResolutionBreakpoints(400);

Page 14: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

미디어 쿼리 장치의 특정 상세를 파악하는데 유용 $.mobile.media(“-webkit-min-device-

pixel-ratio: 2”);

Page 15: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

4. jQuery Mobile 설정 When jQuery Mobile starts, it triggers a mobileinit

event on the document object.

몇가지 설정 옵션을 바꿔서 모든 페이지의 동작방식을 변경

$(window).bind(‘mobileinit', function() { //apply overrides here });

Page 16: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

ns string, default: "" 커스텀데이터 속성에 적용할 네임스페이스

.ui-mobile [data-mynamespace-role=page],

.ui-mobile [data-mynamespace-role=dialog],

Page 17: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

autoInitializePage boolean, default: true When the DOM is ready, the framework should

automatically call $.mobile.initializePage.

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

initializePage : “false”

});

Page 18: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

subPageUrlKey string, default: "ui-page"

서브페이지를 참조할 때 URL 에 쓸 문자열

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

subPageUrlKey : “http://spaceii.com/index.html&ui-page= #page1”

});

Page 19: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

activePageClass string, default: "ui-page-active"

현재 보이는 페이지에 적용될 CSS 스타일

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

activePageClass : “screen”

});

Page 20: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

activeBtnClass string, default: "ui-btn-active"

활성화된 상태의 버튼에 적용될 CSS 스타일

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

activePageClass : “button”

});

Page 21: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

ajaxEnabled boolean, default: true

비동기적 기능인 Ajax 폼처리 , Ajax 링크처리 , URL 해시관리를 켜거나 끔

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

ajaxEnabled : “false”

});

Page 22: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

linkBindingEnabled boolean, default: true

비동기적 기능인 Ajax 폼처리 , Ajax 링크처리 , URL 해시관리를 켜거나 끔

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “false”

});

Page 23: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

hashListeningEnabled boolean, default: true

해시관리를 켜거나 끔

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “false”

});

Page 24: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

pushStateEnabled boolean, default: true

Enhancement to use history.replaceState in supported browsers, to convert the hash-based Ajax URL into the full document path.

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “false”

});

Page 25: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

defaultDialogTransition string, default: 'pop'

Set the default transition for page changes that use Ajax

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “none”

});

Page 26: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

defaultPageTransition string, default: 'fade'

Set the default transition for page changes that use Ajax

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “slide”

});

Page 27: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

touchOverflowEnabled boolean, default: false

Enable smoother page transitions and true fixed toolbars in devices that support both the overflow

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “slide”

});

Page 28: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

minScrollBack string, default: 250

Minimum scroll distance that will be remembered when returning to a page.

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “slide”

});

Page 29: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

loadingMessage string, default: "loading"

Set the text that appears when a page is loading. If set to false, the message will not appear at all.

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “slide”

});

Page 30: Method, Event, Layout API. $.mobile.changePage //transition to the "confirm" page with a "pop" transition without tracking it in history $.mobile.changePage(

pageLoadErrorMessage string, default: "Error Loading Page" Set the text that appears when a page fails to

load through Ajax.

$(window).bind(‘mobileinit', function() {

$.extend( $.mobile, {

linkBindingEnabled : “slide”

});