Home > Web Front-end > JS Tutorial > A brief analysis of the writing of inline buttons and group buttons in jQuery mobile development_jquery

A brief analysis of the writing of inline buttons and group buttons in jQuery mobile development_jquery

WBOY
Release: 2016-05-16 15:27:29
Original
1495 people have browsed it

Inline button data-inline=true
By default, all buttons within the body content are called block-level elements, so they fill the width of the screen.

However, if you want the button to look compact and the width only fits the text and icon inside, then add the data-inline="true" attribute to the button.

2015124160046088.jpg (818×88)

If you have multiple buttons that should sit side by side on the same line, set the data-inline="true" attribute for each button. This will style the button to be the width of its content and float the button so that they sit in the same line.

<a href="index.html" data-role="button" data-inline="true">Cancel</a>
<a href="index.html" data-role="button" data-inline="true" data-theme="b">Save</a>
Copy after login

2015124160112596.jpg (822×91)

Add data-mini="true" to create a more compact version of the inline button:

2015124160130770.jpg (824×60)

<a href="index.html" data-role="button" data-icon="delete" data-inline="true">Cancel</a>
<a href="index.html" data-role="button" data-icon="check" data-inline="true" data-theme="b">Save</a>
Copy after login

2015124160156830.jpg (823×86)

Group button data-role=controlgroup
Sometimes, you want to put a group of buttons into a separate container so that they look like a separate navigation widget. You can wrap a group of buttons in a container, and then add the data-role="controlgroup" attribute to the container. Jquery Mobile will create a vertical button group, delete the margin and shadow between the buttons, and then only add the first The first and last buttons have rounded corners, making them appear to be a group of buttons.

<div data-role="controlgroup">
 <a href="index.html" data-role="button">Yes</a>
 <a href="index.html" data-role="button">No</a>
 <a href="index.html" data-role="button">Maybe</a>
</div>
Copy after login

2015124160223090.jpg (821×146)

Arrange horizontally data-type="horizontal"

By default, the group buttons are displayed as a vertical list. If you add the data-type="horizontal" attribute to the container, it can be converted into a list of horizontal buttons. The buttons will be arranged horizontally one by one and set Only large enough to fit the width of the content. ((So be careful not to have too many buttons or too many words on the buttons in horizontal layout)

<div data-role="controlgroup" data-type="horizontal">
 <a href="index.html" data-role="button">Yes</a>
 <a href="index.html" data-role="button">No</a>
 <a href="index.html" data-role="button">Maybe</a>
</div>
Copy after login

2015124160427751.jpg (829×71)

Mini version data-mini="true"

<div data-role="controlgroup" data-type="horizontal" data-mini="true">
 <a href="index.html" data-role="button">Yes</a>
 <a href="index.html" data-role="button">No</a>
 <a href="index.html" data-role="button">Maybe</a>
</div>
Copy after login

2015124160450552.jpg (815×64)

Icon only data-iconpos="notext"

<div data-role="controlgroup" data-type="horizontal" data-mini="true">
 <a href="index.html" data-role="button" data-icon="arrow-u" data-iconpos="notext">Up</a>
 <a href="index.html" data-role="button" data-icon="arrow-d" data-iconpos="notext">Down</a>
 <a href="index.html" data-role="button" data-icon="delete" data-iconpos="notext">Delete</a>
</div>
Copy after login

2015124160513451.jpg (822×55)

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template