7 May 2012
Basic familiarity working with Dreamweaver and Fireworks is required. Prior experience building websites with the jQuery Mobile Framework, HTML, and CSS is also recommended.
Intermediate
In this article you'll learn how to work with Adobe Fireworks CS6 to create custom jQuery mobile skins and use them in mobile websites based on the jQuery Mobile Framework.
jQuery Mobile Theme Skinning feature enables you to create custom themes or icons using the jQuery template provided within Fireworks. After modifying the jQuery Mobile themes in Fireworks, you can preview it and export the corresponding CSS code and related sprite assets. This article describes how to work with the jQuery Mobile Theme Skinning feature provided by Fireworks.
The jQuery Mobile Framework is a JavaScript framework that allows you to quickly build websites for mobile devices. It is a touch-optimized web framework designed for smartphones and tablets. jQuery Mobile works on the vast majority of all modern desktop, smartphone, tablet, and e-reader platforms. The jQuery Mobile Framework is easy to use and includes web-specific controls such as buttons, sliders, list elements, and many more. When you build mobile websites with the jQuery Mobile Framework you can leverage the default theme provided with the framework.
The jQuery Mobile theme skinning feature enhances the Fireworks workspace to enable you to create custom themes or modify the default jQuery Mobile theme. It also allows to add additional icons or modify the default set of icons used in jQuery Mobile. It generates associated CSS style sheet and sprite assets. You can use the CSS generated by Fireworks to modify the default theme for jQuery Mobile pages to customize it for your projects.
This article describes how you can change or create jQuery Mobile themes using Fireworks and how to apply the new or updated themes to your jQuery Mobile pages.
Without this feature, you have to manually create or modify the CSS styles for jQuery Mobile web pages. You should know the classes that need modification. You should also know the specific class names for applying styles to jQuery webpage elements. Also, it wasn't possible to preview the site to check the appearance of the theme on the website. It was rather time-consuming because you had to switch between modifying the code on a web page and then previewing it in a browser until the desired theme changes are finalized. Also, it was not possible to include additional icons to the sprites or modify existing sprites.
This feature in Fireworks helps save time because you can now modify the default swatches or create new swatches. You can also modify the default icons or include additional icons using the template provided in Fireworks, preview it, and then generate the CSS style sheet and spritesto be used in the jQuery web page. When you apply the CSS code to your jQuery-based web pages for mobile devices, the theme is displayed exactly as it was when you previewed the design in Fireworks.
Every layout and widget included in jQuery Mobile is designed around a new object-oriented CSS framework. The framework makes it possible to apply a complete unified visual design theme to mobile sites and applications.
Consider the following benefits:
The default theme contains the following five bar styles (see Figure 1):
By default, the framework assigns the "A" swatch to all headers and footers because header and footer elements are typically visually prominent in a mobile application. To set the color of a bar to a different swatch color, add the data-theme attribute to your header or footer and set an alternate swatch letter such as "B" or "D" to apply the specified theme swatch color. The CSS code generated for a bar is shown below:
{
border:1px solid #2a2a2a;
background:#111;
color:#fff;font-weight:bold;
text-shadow:0 -1px 1px #000;
background-image:-moz-linear-gradient(top,#3c3c3c,#111);
background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#3c3c3c),color-stop(1,#111));
-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#3c3c3c', EndColorStr='#111111')"
}
To learn more about how the default theme works, read the jQuery Mobile Framework Theme Documentation.
The jQuery Mobile theme includes some default sprite images and swatches. You can use the functionality provided by the Fireworks extension to modify the sprites and swatches. You can also create multiple swatches by duplicating an existing page and customizing a copy of it.
Begin by creating a new theme:
The page name is used to name the swatch. We recommend that you use a single character (a–z) when naming pages. You can create pages by duplicating existing pages and modifying the theme according to the requirement. Each page generates a unique CSS swatch.
The template contains the default sprites and related assets (see Figure 3).
Custom icons can be included to the existing set of sprites. To include additional icons, add icon placeholders to the default jQuery template. After adding placeholders, create icon artwork for different resolutions and color schemes.
Using Fireworks, you can modify the skin based on the theme to match a site's design.
Follow these steps to modify an existing template to update it:
Each object on the canvas corresponds to a section of CSS code in a swatch. The code is indicated by the title of each object (see Figure 6).
After making changes, the next step involves reviewing the recent changes to see how the design appears.
Follow these steps to preview the revised template file:
The Preview panel appears and displays the updated page (see Figure 8).
Click the tabs along the top to switch between the different themes to preview individual swatches applied to various elements.
After you have created or updated a template, you can use Fireworks to generate the jQuery CSS code and the sprites for the site. Choose between one of the following two options to export the CSS swatches and sprites.
To export all of the swatches and sprites at once, choose Commands > jQuery Mobile Theme > Export Theme to generate the swatches and sprites for all pages (see Figure 10).
To export a particular swatch, click Export Current Swatch in the jQuery Mobile Theme In-App Preview panel. Use this strategy when you want to customize only the bar of a particular swatch in order to update it (see Figure 11).
To export only the sprite images, click Export Sprite Images in the jQuery Mobile Theme In-App Preview panel. Sprites for different resolutions and color schemes are generated. A CSS Style sheet contains displacement values for each sprite is also generated. Use this strategy when you want to include custom icons or modify existing icons in the sprite sheet.
At this point you've created the new CSS style sheet file to update the mobile website theme. In this section, you'll learn how to link the CSS file to your mobile website. Follow these steps:
The page is created using the default jQuery Mobile structure style sheet and the theme file that you generated from Fireworks. It is defined in the following tags:
<link href="jquery-mobile/jquery.mobile.theme-default.css" rel="stylesheet" type="text/css" />
<link href="jquery-mobile/jquery.mobile.structure-1.0.min.css" rel="stylesheet" type="text/css" />
<link href="jquery-mobile/theme_f.css" rel="stylesheet" type="text/css"/>.For example, rather than using the default "A" bar design, you can use code to apply a different bar style, like this:
<div data-role="header" data-theme="f">
After applying these changes, click the Live View button to review how the updated theme appears within the Dreamweaver workspace (see Figure 14).
<a href=”#” data-role="button" data-icon="favorites">Button</a>
The data-icon value, “favorites”, is the name with which the icon was created in Fireworks.
For more details, see the Creating icon placeholders section above.
Note: In accordance with the jQuery Mobile Framework, Fireworks does not export patterns to optimize the size of the exported content.
As you've seen in this article, you can use Fireworks to create and update jQuery Mobile website themes to build and manage websites for devices. The updated interface includes the ability to generate the CSS style sheets that you can use to redesign mobile apps and sites.
Fireworks makes it easier than ever before to build and deploy web designs across multiple screens. Additionally, since the generated CSS is cross-platform compatible, the sites you create will perform and appear as expected on smartphones and tablets. Use the preview options in Dreamweaver to review the changes in Live View or in a browser in order to check your work before publishing the changes. You can also preview inside Fireworks.
To learn more about extending Fireworks to create CSS style sheets, read Extracting CSS properties from design objects in Fireworks using the CSS3 Mobile Pack, and watch the Fireworks senior product manager, Takashi Morifusa, demonstrate the CSS3 Properties panel and jQuery Mobile theme skinning tool. Also be sure also to check out the HTML5 and CSS3 Development Center.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
Fireworks Forum |
More |
Fireworks Cookbooks |
More |
| 09/07/2011 | How do I use FXG XML markup in Shape subclasses? |
|---|---|
| 10/15/2010 | Flex4 Dotted Line |
| 06/25/2010 | ComboBox that uses a NativeMenu (Air API) |
| 05/21/2010 | Localizing a Creative Suite 5 extension |