Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Buttons > Creating Custom Icons

Creating Custom Icons

If we want to provide our own custom icons, we just need to define our own unique name in the data-icon attribute. The preferred naming scheme to use is <app-name>-<icon-name>, for example: myapp-tweet.

Note

jQuery Mobile will automatically add a white circled background to the icon, so it will work on every row background without any problem.

jQuery will also expect us to create a CSS class called ui-icon-<name>, for example, ui-icon-myapp-tweet, and specify a background image. To reduce UI problems, the icon should be in white (or transparent), saved as a 18×18 pixel PNG-8 with alpha transparency. The icon should not have any border; the framework will add it when using the icon in the list view. The icon should also be smaller than 18×18 pixels, because it will be rendered inside a circle that is 18 pixels wide. Our icon should be drawn inside the circle, so don’t use the corners.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial