


Use jQuery to add buttons and icons to buttons on mobile pages_jquery
Create button data-role=button
Add data-role="button" attribute to HTML elements. jQuery Moble will enhance this element to a button style. The Jquery Mobile framework contains a set of icons required by the most commonly used mobile applications. In order to reduce the download size, Jquery Mobile contains white icon sprite images and automatically adds a translucent black circle after the icon to ensure Pictures can be displayed clearly on any background color.
Style Link Button
In the main content block of a web page, you can style any anchor link for a button by adding the data-role="button" attribute. The framework will enhance link buttons with markup and class linking methods. For example, this tag:
<a href="index.html" data-role="button">Link button</a>
NOTE: Styles like button links are identical to the visual selection of the real form below the button, but there are some important differences. Based on the link button, the button is a plug-in, which not only uses the basic button tag plug-in to generate the style of the button, so the form button methods (enable, disable, refresh) are not supported. If you need to disable a link-based button (or element), it's possible to apply a disability level UI to the disabled person themselves using javascript to achieve the same effect.
Mini version data-mini="true"
For a more compact version that is useful in toolbars and tight spaces, add the data-mini="true" attribute to the button to create a mini version.
<a href="index.html" data-role="button" data-mini="true">Link button</a>
Add an icon to the button data-icon
The jQuery Mobile framework includes a selected set of icons that mobile applications typically require. To minimize download size, jQuery Mobile contains a single white icon sprite, and automatically adds a translucent black circle behind the icon to ensure it contrasts well with any background color.
An icon can be added to a button by adding an icon property to the anchor specifying the icon data to be displayed. For example, the following tag:
<a href="index.html" data-role="button" data-icon="delete">Delete</a>
Mini version adds data-mini="true" attribute
Icon style list
jQuery Mobile comes with many small button icons, as shown below:
Left arrow: data-icon="arrow-l"
Right arrow: data-icon="arrow-r"
Up arrow: data-icon="arrow-u"
Down arrow: data-icon="arrow-d"
Delete: data-icon="delete"
Add: data-icon="Plus"
Reduce: data-icon="minus"
Check: data-icon="Check"
Gear: data-icon="gear"
Forward: data-icon="Forward"
Back: data-icon="Back"
Grid: data-icon="Grid"
Pentagram: data-icon="Star"
Warning: data-icon="Alert"
Information: data-icon="info"
Home page: data-icon="home"
Search: data-icon="Search"
Icon positioning data-iconpos
By default, all icons are placed to the left of the button's button text. This default can be overridden by using the data-iconpos attribute to set the text of the top, bottom, right, and left of the icon. For example, tag:
<font color=#0000ff><a href="index.html" data-role="button" data-icon="delete" data-iconpos="right">Delete</a>
Hide text on images data-iconpos="notext"
You can also create an icon button and set data-iconpos="notext". The Button plugin will hide the text on the screen, but use it as a contextual link title attribute to give screen readers and devices that support tooltips. For example, data-iconpos="right", data-iconpos="notext":
<a href="index.html" data-role="button" data-icon="delete" data-iconpos="notext">Delete</a>
迷你和内联
迷你和内联属性可以被添加到产生更紧凑的按钮
自定义图标 data-icon="自定义值"
使用自定义图标,需要指定 data-icon 值。Jquery Mobile的button插件会将生成一个CSS类,它的前缀是ui-icon- ,后面的是data-icon值。假如:有一个按钮 data-icon 属性的值为 myapp-email,即 data-icon=“ myapp-email”。那么生产的CSS类是:ui-icon-myapp-email。
然后你可以在你的样式表写一个CSS规则来定义 ui-icon-myapp-email。然后在css中指定这个类的背景图片地址。为了保持与其他图标的视觉上的一致性,请创建一个白色18x18像素的PNG-8图标,并且保存为Alpha透明度。
.ui-icon-myapp-email { background-image: url( "app-icon-email.png" ); }
这将创建标准分辨率的图标,但许多设备都有非常高的分辨率的显示器,就像iPhone 4的视网膜显示器。添加一个高清图标,创建一个图标,36X36像素(18像素大小完全相同的两倍),并添加第二个规则使用WebKit分钟装置像素比例:2。媒体查询到目标的规则只有以高分辨率显示器。指定背景图片高清图标文件和设置背景像素大小18x18将安装36个像素图标到同一个18像素的空间。传媒查询块可以用多个图标规则:
@media only screen and (-webkit-min-device-pixel-ratio: 2) { .ui-icon-myapp-email { background-image: url( "app-icon-email-highres.png" ); background-size: 18px 18px; } ...more HD icon rules go here... }

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



According to news on July 23, blogger Digital Chat Station broke the news that the battery capacity of Xiaomi 15 Pro has been increased to 6000mAh and supports 90W wired flash charging. This will be the Pro model with the largest battery in Xiaomi’s digital series. Digital Chat Station previously revealed that the battery of Xiaomi 15Pro has ultra-high energy density and the silicon content is much higher than that of competing products. After silicon-based batteries are tested on a large scale in 2023, second-generation silicon anode batteries have been identified as the future development direction of the industry. This year will usher in the peak of direct competition. 1. The theoretical gram capacity of silicon can reach 4200mAh/g, which is more than 10 times the gram capacity of graphite (the theoretical gram capacity of graphite is 372mAh/g). For the negative electrode, the capacity when the lithium ion insertion amount reaches the maximum is the theoretical gram capacity, which means that under the same weight

There could be several reasons why your Windows laptop won't boot. Memory failure, dead battery, faulty power button, or hardware issues are all common causes. Here are some solutions to help you resolve this issue. Laptop won't turn on after pressing the power button If your Windows laptop still won't turn on after pressing the power button, here are some steps you can take to resolve the issue: Is your laptop fully charged? Perform a hard reset to clean your laptop Reseat the memory Transparent CMOS type battery Take your laptop for repair. 1] Is your laptop fully charged? The first thing to do is to check if your laptop is fully charged. Laptop won't start if battery is drained

After the release of the iPhone 15 series, there have been constant revelations about the appearance and configuration of Apple’s new iPhone 16. What does iPhone 16 look like? Is there any improvement in iPhone 16? Recently, an overseas blogger showed off the design of the iPhone 16 series. The overall design is basically the same as the iPhone 15 series. As you can see from the picture, the entire iPhone 16 series is equipped with a new "shoot" button as standard, allowing users to take photos more conveniently. In addition, other design details are still unknown. The message shows that this new button will be used to shoot videos and is located below the power button. Previous news has mentioned that it may be a capacitive solid-state button, but recent reports indicate that it should still be a

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

"Operation Delta" will launch a large-scale PC test called "Codename: ZERO" today (March 7). Last weekend, this game held an offline flash mob experience event in Shanghai, and 17173 was also fortunate to be invited to participate. This test is only more than four months away from the last time, which makes us curious, what new highlights and surprises will "Operation Delta" bring in such a short period of time? More than four months ago, I experienced "Operation Delta" in an offline tasting session and the first beta version. At that time, the game only opened the "Dangerous Action" mode. However, Operation Delta was already impressive for its time. In the context of major manufacturers flocking to the mobile game market, such an FPS that is comparable to international standards

How to remove the height attribute of an element with jQuery? In front-end development, we often encounter the need to manipulate the height attributes of elements. Sometimes, we may need to dynamically change the height of an element, and sometimes we need to remove the height attribute of an element. This article will introduce how to use jQuery to remove the height attribute of an element and provide specific code examples. Before using jQuery to operate the height attribute, we first need to understand the height attribute in CSS. The height attribute is used to set the height of an element

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: <

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:
