Home Web Front-end H5 Tutorial Xiaoqiang's road to HTML5 mobile development (44) – Buttons in JqueryMobile

Xiaoqiang's road to HTML5 mobile development (44) – Buttons in JqueryMobile

Feb 15, 2017 pm 01:21 PM

1. Link button


<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title>jQuery Mobile Web 应用程序</title>
<link href="jquery-mobile/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
</head> 
<body>
<p data-role="page" id="page1" data-fullscreen="true">
    <p data-role="content">
    	<a href="#" data-role="button">链接按钮</a>
    </p>
</p>
</body>
</html>
Copy after login

2. Form button


<p data-role="page" id="page1" data-fullscreen="true">
    <p data-role="content">
    	<a href="#" data-role="button">链接按钮</a>
        <form>
        	<input type="button" value="表单按钮"/>
            <button type="submit">提交按钮</button>
            <input type="submit" value="提交按钮"/>
            <input type="reset" value="重置按钮"/>
        </form>
    </p>
</p>
Copy after login

3. Graphic button


            图像按钮1:
            <input type="image" src="jquery-mobile/images/icon.png" data-role="none"/>
            图像按钮2:
            <a href="#"><img src="jquery-mobile/images/icon.png"></a>
Copy after login

4. Button with icon


            <input type="button" value="带图标的按钮" data-icon="delete"/>
   	    <input type="button"  data-icon="delete" data-iconpos="notext"/>
   	    <input type="button"  data-icon="alert" data-iconpos="notext"/>
            <input type="button"  data-icon="arrow-d" data-iconpos="notext"/>
            <input type="button"  data-icon="arrow-l" data-iconpos="notext"/>
            <input type="button"  data-icon="arrow-r" data-iconpos="notext"/>
            <input type="button"  data-icon="arrow-u" data-iconpos="notext"/>
            <input type="button"  data-icon="back" data-iconpos="notext"/>
            <input type="button"  data-icon="check" data-iconpos="notext"/>
            <input type="button"  data-icon="custom" data-iconpos="notext"/>
            <input type="button"  data-icon="forward" data-iconpos="notext"/>
            <input type="button"  data-icon="gear" data-iconpos="notext"/>
            <input type="button"  data-icon="grid" data-iconpos="notext"/>
            <input type="button"  data-icon="home" data-iconpos="notext"/>
            <input type="button"  data-icon="info" data-iconpos="notext"/>
            <input type="button"  data-icon="minus" data-iconpos="notext"/>
            <input type="button"  data-icon="plus" data-iconpos="notext"/>
            <input type="button"  data-icon="refresh" data-iconpos="notext"/>
            <input type="button"  data-icon="search" data-iconpos="notext"/>
            <input type="button"  data-icon="star" data-iconpos="notext"/>
Copy after login


##5. Button positioning


            <a href="#" data-role="button" data-icon="arrow-u" data-iconpos="top">top</a>
            <a href="#" data-role="button" data-icon="arrow-l" data-iconpos="left">left</a>
            <a href="#" data-role="button" data-icon="arrow-r" data-iconpos="right">right</a>
            <a href="#" data-role="button" data-icon="arrow-d" data-iconpos="bottom">bottom</a>
Copy after login

6. Custom icon button


<a href="#" data-role="button" data-icon="custom_icon">自定义图标</a>
Copy after login
.ui-icon-custom_icon{
	background:url(jquery-mobile/images/icon.png) 50% 50% no-repeat;
	background-size:14px 14px;
}
Copy after login

Note: Attribute naming rule ".ui-icon-, such as .ui above -icon-custom_icon


7. Group button


        <p data-role="controlgroup" data-type="horizontal" align="center" class="segment-control">
            <a href="#" data-role="button" class="ui-control-active">菜单一</a>
            <a href="#" data-role="button" class="ui-control-inactive">菜单二</a>
            <a href="#" data-role="button" class="ui-control-inactive">菜单三</a>
        </p>
Copy after login

8. Theme button


            <a href="#" data-role="button" data-theme="a">A</a>
            <a href="#" data-role="button" data-theme="b">B</a>
            <a href="#" data-role="button" data-theme="c">C</a>
            <a href="#" data-role="button" data-theme="d">D</a>
            <a href="#" data-role="button" data-theme="e">E</a>
            <a href="#" data-role="button" data-theme="f">F</a>
Copy after login

9. Dynamic button


<script type="text/javascript">
	$(&#39;<a href="#" data-role="button" data-icon="star" id="b1">动态按钮</a>&#39;).appendTo("#content").button();
	$(&#39;<a href="#" data-role="button" data-icon="delete" id="b2">动态按钮</a>&#39;).insertAfter("#b1").button();
</script>
Copy after login

There is also a json method


	$(&#39;<a href="#">动态按钮</a>&#39;).insertAfter("#a1").button({
			&#39;icon&#39;:&#39;home&#39;,
			&#39;inline&#39;:true,
			&#39;shadow&#39;:true,
			&#39;theme&#39;:&#39;b&#39;
		});
Copy after login

Both of the above methods use the button() plug-in. The button plug-in has the following options:

corners boolean

icon string

iconpos string

iconshadow boolean

initSelector css selector string

inline boolean

shadow boolean

The button plug-in has the following two methods:

$("#button1").button("enable");

$("#button2").button("disable");

All The code is as follows:


 



jQuery Mobile Web 应用程序




 

链接按钮

图像按钮1: <input type="image" src="jquery-mobile/images/icon.png" data-role="none"/> 图像按钮2: <a href="#"><img src="jquery-mobile/images/icon.png"></a> <a href="#" data-role="button" data-icon="arrow-u" data-iconpos="top">top</a> <a href="#" data-role="button" data-icon="arrow-l" data-iconpos="left">left</a> <a href="#" data-role="button" data-icon="arrow-r" data-iconpos="right">right</a> <a href="#" data-role="button" data-icon="arrow-d" data-iconpos="bottom">bottom</a> <a href="#" data-role="button" data-icon="custom_icon">自定义图标</a> A B C D E F

Copy after login
The above is Xiaoqiang’s HTML5 mobile development path (44) - the content of the button in JqueryMobile. For more related content, please pay attention to PHP Chinese website (www.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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

See all articles