티스토리 뷰
제이쿼리모바일 그리드 레이아웃이다.
레이아웃 구성시에 참고해서 작성하면 좋을듯.
Today I will explain to you how to use Jquery Mobile Grid layout, which allows to build multiple columns ranges between two to five columns .
We need this technique to place small elements side-by-side (like hours, minutes and seconds text box groups).
Jquery mobile provides a block style class called ui-grid, this class is the core of grid layout. It is 100% width, with no borders or backgrounds, and without padding or margins.
To build two columns layout, we can use ui-grid-a. The others can be used as the following:
class | Layout | Width |
ui-grid-a | Two-column | 50/50% |
ui-grid-b | Three-column | 33/33/33% |
ui-grid-c | Four-column | 25/25/25/25% |
ui-grid-d | Five-column | 20/20/20/20/20% |
For example, we can use ui-grid-a as the following:
<div class="ui-grid-a">
</div>
Inside this two-column layout, we can place the two columns.
<div class="ui-grid-a">
<div class="ui-block-a">
Left Block</div>
<div class="ui-block-b">
Right Block
</div>
</div>
Ui-block-a class says: this is the first column in the grid, and ui-block–b is the second one in the same grid.
Here you can find that ui-block changes the CSS Clear property to the left. This property specifies the left side of the element, where other floating elements are not allowed.
Furthermore, you can give that block a style by using ui-bar class by default without having any style. You can also assign any style to the block (like height, background, etc):
<div class="ui-grid-a">
<div class="ui-block-a">
<div class="ui-bar ui-bar-b">Left Block</div>
</div>
<div class="ui-block-c">
<div class="ui-bar ui-bar-b">Right Block</div>
</div>
</div>
The layout would be like this:
Apply Grid to Content Container:
Grid classes can be applied to any container. In the previous example, I used it with Fieldset and applied the block to the two buttons.
<fieldset class="ui-grid-a">
<div class="ui-block-a">
<button type="button" data-theme="b">Add</button></div>
<div class="ui-block-b">
<button type="button" data-theme="e">Delete</button></div>
</fieldset>
You will find that every block -div- is stretched to 50% of the screen width.
In the same way, we can create a three-column layout for time entry:
<fieldset class="ui-grid-b">
<div class="ui-block-a">
<label id="Label10" for="txtHours">
Time</label></div>
<div class="ui-block-b">
<input type="text" name="txtHours" id="txtHours" value="12" style="width:40px" maxlength="2" /> </div>
<div class="ui-block-c">
<input type="text" name="txtMinutes" id="txtMinutes" value="00" style="width:40px" maxlength="2" /></div>
</fieldset>
The letters sequence after ui-block class refers to the column number. So, “a" refers to the fist column, "b" to the second one, and so on. In this way we can create multiple rows of items.
There is an important thing by using multiple rows of items. ui-block-a CSS Class is used to
clear the floats and start a new line. Therefore the sequence is important to build the items.
Here you can find an example of multiple rows of items:
<div data-role="content">
<fieldset class="ui-grid-b">
<div class="ui-block-a">
<img alt="" src="images.jpg" style="width: 80px; height: 80px" />
</div>
<div class="ui-block-b">
<img alt="" src="images.jpg" style="width: 80px; height: 80px" />
</div>
<div class="ui-block-c">
<img alt="" src="images.jpg" style="width: 80px; height: 80px" />
</div>
<div class="ui-block-a">
<img alt="" src="images.jpg" style="width: 80px; height: 80px" />
</div>
<div class="ui-block-b">
<img alt="" src="images.jpg" style="width: 80px; height: 80px" />
</div>
<div class="ui-block-a">
<img alt="" src="images.jpg" style="width: 80px; height: 80px" />
</div>
</fieldset>
The layout would be like this:
Note that how a new line is started in the third line by using ui-block-a CSS Class.
Hope that helps.
출처 : http://weblogs.asp.net/yousefjadallah/archive/2011/07/11/grid-layout-in-jquery-mobile.aspx
'프로그래밍 > Jquery Mobile' 카테고리의 다른 글
JQuery Mobile Code Snippets 2 (0) | 2012.04.09 |
---|---|
JQuery Mobile Code Snippets 1 (0) | 2012.04.09 |
jquerymobile 에서 페이지 로딩시 자바스크립트 실행 하기 (0) | 2012.04.04 |
Jquery Mobile 페이지 이동방식, swipeleft, swiperight (0) | 2012.03.30 |
JqueryMobile(제이쿼리 모바일) 에 들어가보니!! (0) | 2012.03.28 |
- Total
- Today
- Yesterday
- css3
- html5
- jQuery
- 자바스크립트
- IE
- workbook
- Excel
- ASP.NET
- Mobile
- WCF
- jquery chart
- 프로시저
- Chart
- Style
- 저장프로시저
- drag&drop
- 셀렉터
- MSSQL
- Ajax
- WebApi
- json
- grid
- jQuery Mobile
- SVG
- JS
- rowspan
- radius
- 제이쿼리
- JavaScript
- CSS
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |