3 October 2011
Herramientas de página |
Basic familiarity working with Dreamweaver and Fireworks is required. Prior experience building websites with the jQuery Mobile Framework, HTML, and CSS is also recommended.
Intermedio
In this article you'll learn how to work with the Adobe Fireworks CSS3 Mobile Pack to create and maintain mobile websites using the jQuery Mobile Framework.
The CSS3 Mobile Pack includes two new features:
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 extension enhances the Fireworks workspace to enable you to create or modify the default jQuery Mobile theme. It also generates the 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 CSS3 Mobile Pack for Fireworks and how to apply the new or updated themes to your jQuery Mobile pages.
Before the CSS3 Mobile Pack was available, it was necessary to manually modify the CSS style sheet when you created a theme for a jQuery-based mobile website. Until recently, 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 were finalized.
The CSS3 Mobile Pack helps save time because you can now create or update a jQuery Mobile theme in Fireworks, preview it, and then generate the CSS style sheet and sprites for the site. 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).
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 4).
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 6).
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 > Export Theme to generate the swatches and sprites for all pages (see Figure 8).
To export a particular swatch, click Export Current Swatch in the jQuery Mobile Theme Preview panel. Use this strategy when you want to customize only the bar of a particular swatch in order to update it (see Figure 9).
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:
<link href="jquery-mobile/jquery.mobile-1.0a3.min.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="page" id="page" 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 11).
When you test, it's important to review the changes on the mobile device to make sure everything appears as expected. But when you are still designing the mobile app, you can save time by choosing File > Preview in Browser > Device Central to see how the content appears in a mobile emulator for the targeted device (see Figure 12).
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 the CSS3 Mobile Pack for 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