하이브리드앱

본문 바로가기

사이트 내 전체검색


4. 위젯 옵션 변경

페이지 정보

작성자 관리자 댓글 0건 조회 1,071회 작성일 22-01-09 22:03

본문

옵션 : data-iconpos처럼 data-속성명 형태로 사용되는 속성명

data-theme, data-icon, data-inline


실습 : jMobile04.html

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>제이쿼리 모바일 연습</title>
<script type="text/javascript">
var init = function(){
$('#txtBtn').click(function(){
$('#btn1').text("New버튼1");
} );
};
$(document).bind('pageinit', init);
</script>

</head>
<body>
<div data-role="page">
<div data-role="header" data-position="fixed">
<h1>위젯 옵션 변경</h1>
</div>
<div role="main" class="ui-content">
<button data-icon="carat-r" data-iconpos="right" id="btn1">버튼1</button>
<button id="txtBtn">텍스트변경</button>

<div data-role="footer" data-position="fixed"> 
<h1>powered by jQueryMobile.com</h1>
</div>
</div>
</body>
</html>





1.PNG


2.PNG



실습 : jMobile04.html


<!doctype html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

<title>제이쿼리 모바일 연습</title>

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />

<script src="http://code.jquery.com/jquery-latest.min.js"></script>

<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

<script type="text/javascript">

var init = function(){

$('#txtBtn').click(function(){

$('#btn1').val("New버튼1");

$('#btn1').button('refresh');

} );

};

$(document).bind('pageinit', init);

</script>


</head>

<body>

<div data-role="page">

<div data-role="header" data-position="fixed">

<h1>위젯 옵션 변경</h1>

</div>

<div role="main" class="ui-content">

<input type="button" data-icon="carat-r" data-iconpos="right" id="btn1" value="버튼1" />

<button id="txtBtn">텍스트변경</button>


<div data-role="footer" data-position="fixed"> 

<h1>powered by jQueryMobile.com</h1>

</div>

</div>

</body>

</html>


아래의 명령은 같은 기능을 한다.


$('#btn1').val("New버튼1");

$('#btn1').attr('value', 'New버튼1');

$('#btn1').prop('value', 'New 버튼1'); //property(porp) 속성 = attribute(attr) 



1.PNG


2.PNG


실습 : jMobile04.html


<!doctype html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

<title>제이쿼리 모바일 연습</title>

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />

<script src="http://code.jquery.com/jquery-latest.min.js"></script>

<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

<script type="text/javascript">

var init = function(){

$('#topBtn').click(function(){

$('#btn1').button('option','iconpos','top');

$('#btn1').button('option','icon','carat-u');

});

$('#leftBtn').click(function(){

$('#btn1').button('option','iconpos','left');

$('#btn1').button('option','icon','carat-l');

});

$('#rightBtn').click(function(){

$('#btn1').button('option','iconpos','right');

$('#btn1').button('option','icon','check');

});

$('#downBtn').click(function(){

$('#btn1').button('option','iconpos','bottom');

$('#btn1').button('option','icon','carat-d');

});


};

$(document).bind('pageinit', init);

</script>


</head>

<body>

<div data-role="page">

<div data-role="header" data-position="fixed">

<h1>위젯 옵션 변경</h1>

</div>

<div role="main" class="ui-content">

<input type="button" data-icon="carat-r" data-iconpos="right" id="btn1" value="버튼1" />

<h3 class = "ui-bar ui-bar-b ui-corner-all">아이콘 위치 변경</h3>

<div class="ui-body">

<button data-inline="true" id="topBtn">Up</button>

<button data-inline="true" id="downBtn">Bottom</button>

<button data-inline="true" id="rightBtn">Right</button>

<button data-inline="true" id="leftBtn">Left</button>

</div>


<div data-role="footer" data-position="fixed"> 

<h1>powered by jQueryMobile.com</h1>

</div>

</div>

</body>

</html>



3.PNG


4.PNG


실습 : jMobile04.html


<!doctype html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

<title>제이쿼리 모바일 연습</title>

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />

<script src="http://code.jquery.com/jquery-latest.min.js"></script>

<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

<script type="text/javascript">

var init = function(){

$('#inlineBtn').click(function(){

$('#btn2').button('option','inline','true');

});

$('#noinlineBtn').click(function(){

$('#btn2').button('option','inline','false');

});


};

$(document).bind('pageinit', init);

</script>


</head>

<body>

<div data-role="page">

<div data-role="header" data-position="fixed">

<h1>위젯 옵션 변경</h1>

</div>

<div role="main" class="ui-content">

<input type="button" id="btn2" value="버튼2" />

<button id="inlineBtn">인라인버튼 만들기</button>

<button id="noinlineBtn">버튼 만들기</button>


<div data-role="footer" data-position="fixed"> 

<h1>powered by jQueryMobile.com</h1>

</div>

</div>

</body>

</html>




5.PNG


6.PNG


댓글목록

등록된 댓글이 없습니다.



개인정보취급방침 서비스이용약관
Copyright © www.leelab.co.kr All rights reserved.
상단으로
TEL. 063-469-4551 FAX. 063-469-4560
전북 군산시 대학로 558
군산대학교 컴퓨터정보공학과
PC 버전으로 보기