Jquery Mobile custom button icon _jquery

Source: Internet
Author: User

A lot of friends are reactive jquery Mobile with the icon is really few, and I also think the icon is small (the system with the 18*18), and then pondering how to customize the button icon, the following small set my method to share to everyone.

Just touching the jquery mobile framework, encounter a very real problem, is how to customize the button icon, I think the jquery mobile itself with the icon is too little, and I think the icon is also small (the system should be 18*18) below is my method, I hope everyone enthusiastically shot bricks.

1, the first method is relatively simple, but there is a prerequisite, the premise is that your custom icon size should be consistent with the system built-in, so the layout will not be a problem, the specific methods are as follows:

First define the CSS file

. ui-icon-email{
  Background:url ('./images/email.png ') no-repeat 0px 0px;
data-icon= "Email"

It's OK.

2, the second method, this method is suitable for the custom icon size and system inconsistencies, the gossip does not say, first on the effect chart,

3, the code is as follows:

"CSS Code"

/** icon size **/. user-ui-btn. ui-icon{width:36px;
height:36px;
 /** set the font size, because the icon becomes larger, so the text appropriate to increase some **/. user-ui-btn. ui-btn-text{line-height:36px;
font-size:20px;
 /** No Text button **/. user-ui-btn. ui-btn-icon-notext{width:42px;
 height:42px;
 Webkit-border-radius:2em;
Border-radius:2em; /** icon left **/. user-ui-btn. Ui-btn-icon-left. ui-btn-inner {padding-left:50px. user-ui-btn
 on{left:10px;
Margin-top: -18px; The/** icon is on the right **/. user-ui-btn. ui-btn-icon-right. ui-btn-inner {padding-right:50px. user-ui-btn. u
 i-icon{right:10px;
Margin-top: -18px; The/** icon **/. user-ui-btn. ui-btn-icon-top. ui-btn-inner {padding-top:50px. user-ui-btn
 {top:10px;
Margin-left: -18px;  /** icon below **/. user-ui-btn. Ui-btn-icon-bottom. ui-btn-inner {padding-bottom:50px. user-ui-btn. Ui-btn-icon-bottom
 . ui-icon{bottom:10px;
Margin-left: -18px; /** define your own icon **/. user-ui-btn. ui-icon-demo1{background:url ('./Images/gentleface_full.png ') no-repeat-108px 0px; }. user-ui-btn. ui-icon-demo2{background:url ('./images/gentleface_full.png ') no-repeat-180px-180px; user-ui-btn.
 ui-icon-demo3{Background:url ('./images/gentleface_full.png ') no-repeat-252px-360px; user-ui-btn. ui-icon-demo4{
Background:url ('./images/gentleface_full.png ') no-repeat-36px-180px; }. user-ui-btn. ui-icon-demo5{background:url ('./images/gentleface_full.png ') no-repeat-504px-612px;} <!doctype html>  

The above content is this article for you to explain the jquery Mobile custom button icon Implementation method, I hope you like.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.