Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

jQuery mobile integration

From: Dreamweaver CS5.5 New Features

Video: jQuery mobile integration

With the Dreamweaver CS5.5 release, Adobe is adding several mobile application development tools. In this chapter, I want to go over some of those tools and along the way discuss Adobe's strategy regarding Dreamweaver and mobile development. Now the first thing I want to discuss is jQuery Mobile. jQuery Mobile is one of the most popular mobile user interface open-source frameworks in use today. In the CS5.5 release, Adobe has integrated this framework into Dreamweaver, which makes it extremely easy to build interfaces for your mobile applications, even if you've never used jQuery or jQuery Mobile before.

jQuery mobile integration

With the Dreamweaver CS5.5 release, Adobe is adding several mobile application development tools. In this chapter, I want to go over some of those tools and along the way discuss Adobe's strategy regarding Dreamweaver and mobile development. Now the first thing I want to discuss is jQuery Mobile. jQuery Mobile is one of the most popular mobile user interface open-source frameworks in use today. In the CS5.5 release, Adobe has integrated this framework into Dreamweaver, which makes it extremely easy to build interfaces for your mobile applications, even if you've never used jQuery or jQuery Mobile before.

So I went ahead and redefined my site so that the root folder for the local site is the 04_01 directory. We don't have any exercise files for this particular example because we're going to build it from scratch. So the first thing I'm going to do is go up to File and choose New, and one of the nice things that they've done to Dreamweaver that you might miss if you're not really paying attention is they've added some things to the Page from Sample. Now, most people that I know don't even go down there, because who needs a frameset, right? Well, now they have Mobile Starters in there as well, which is really cool.

So they give you a jump-start on developing a mobile application. So we have sample pages for jQuery Mobile, and we have three different mobile frameworks. And we're going to choose the PhoneGap framework, because we're going to be utilizing that a little bit later on. So I'm going to choose jQuery Mobile (PhoneGap), make show the DocType is HTML 5, and I'm going to go ahead and click Create. Now as soon as you do that, it creates a page for us, and it goes ahead and gives us some existing structure to the page. If I look at this in Design view, I can see that I have just some div tags with some existing structure in them for pages One, Two, Three, and Four.

Now if you don't understand jQuery Mobile, that might seem a little weird at first. But with jQuery Mobile, it uses div structures to create pages. So you could think of these pages as being screens that are animated into place, and each div tag can be a separate page, so you can literally have one HTML file and have multiple pages in it. All right! So what I want to do now is I want to go ahead and save this file, and I'm going to save this into 04_01, and I'm going to save this as index.html.

Now, I know normally I tell you that it doesn't matter if it's HTM or HTML, but in this case, it is very important that you name this index.html because later on when we're running this inside the Android Emulator, it's going to look for that .html file, not .htm. So I'm going to go ahead and save that, and when you save a jQuery Mobile file for the first time within a site, Dreamweaver is going to say hey, this requires some dependent files. We need the CSS file that's going to be styling these. We need the JavaScript files that are going to be controlling the functionality. Do you want me to go ahead and copy those over now? You can just say yes and go ahead and copy them.

Now what it's going to do with these files, it's going to place them in a directory named jquery-mobile, and if you open that up, you can kind of see how that's structured. Now, if you have an existing scripts folder where you want to reorganize these files, you can do that. But one of the things that you need to be aware of is, if I switch over to the source code, these files are being linked to this page. So if you were to move those around, make sure that Dreamweaver is also updating those links, or your functionality is going to be negatively affected. Okay, so I'm going to stay in Code view because it's probably the easiest way to customize and change our jQuery Mobile interface.

So let's see what this looks like currently. I'm just going to go ahead and preview this in Chrome, and I recommend using a WebKit-based browser. It just seems that jQuery Mobile works better with those at the moment. Now I can see that the default structure of the page is to have a header up top, a footer on the bottom, and I have links to pages Two, Three, and Four. If I click on one of those, you can actually see it animate over, and the Back button takes me back. So it's a navigation scheme that's really designed for smaller screens, like mobile devices. I'm going to go ahead and close my browser and go back into my code.

Now if I scroll down and look at the code, the structure makes itself maybe a little bit more apparent. You can see that each one of those pages is just a div tag, and inside that, we have other data tags that are providing the rest of the page structure. What's really neat about jQuery Mobile is it uses this data-role attribute to describe what the contents of that div tag are. So in this case the data-role is a page, and in this case the data-role is a header, which is why it showed up as the header bar, and here we have our content. So you could go in and you could modify these.

So, for example, I could come in and instead of Page One, I can just go ahead and say 'Explore California.' And you're free to customize these any way that you want. Inside the div that has the role of content, for example, I'm going to put an h1 tag, and inside that, I'm going to type in Tour Finder, which is the app that we're going to be building. We're going to be building the Explore California Tour Finder. Now one thing that you do want to be careful about, however, is the divs that have a distinct data-role to them. You want to be very, very careful about modifying those, because they determine the structure of the page and their data-roles are what drives the user interface that jQuery builds, so be very careful about changing those up.

Now I did want to show off a lot of the integration features inside Dreamweaver, so one of the first things I want to do is I want to take the navigation list that's already there that's existed based on the sample that we created and I want to get rid of that. So this unordered list, go ahead and highlight that and delete it. It doesn't mean that I'm not going to use an unordered list from navigation; it's just that I want to use some of the other Dreamweaver integration to go ahead and put that in. So if I look at my Insert toolbar, I now have a setting for jQuery Mobile. Now I am in the Classic workspace, which docks the Insert panel up at the top as a toolbar.

You might see it over here on our panel dock, which is fine. You can access the same things here, or you can do what I like to do, which is to have it in Classic mode so that it appears up top. So for jQuery Mobile, we've got all these little different widgets that we can place on the page: flip toggle switches, sliders, radio buttons, dropdown menus, text areas-- so, a lot of user interface components. Now we also have things like collapsible blocks, which of course will either expand to show the content or collapse, much like an accordion widget. We have layout grids that will help you create two- or three-column layouts within your phone, and we also have what's known as the jQuery Mobile List view.

Mobile devices have totally different interface requirements, and so one of the things that really works well in mobile environments are lists, not only to display data but also to facilitate navigation. So I'm going to go right here and click the jQuery Mobile List View to insert one of those, and I made sure that my cursor was just after the Tour Finder where my navigation used to be. Now we can choose either an Ordered or Unordered List. So if you wanted numbers to your navigation or to your list, you could go ahead and select that. You can also choose the number of items. I'm going to leave that at 3 actually. And I can choose a different type of list.

Now unless you know a lot about jQuery Mobile and how these widgets are constructed, some of these choices really aren't going to make any sense to you. So obviously, if you're using this for the first time, you're probably going to want to consult the jQuery documentation. I'm going to show you that in just a moment when we're finished with this exercise. Out of all these choices, I'm going to choose Text Description, because what Text Description allows me to do is to not only have the link itself, but a description of the link underneath it, so that you can provide maybe a little bit of extra information. We also have things like Split buttons, which will have two clickable links on either side.

So if you, for example, had a list of songs, the button on the left could play the song and the button on the right could perhaps prompt somebody to purchase it. So we're going to do Text Description, click OK, and now I get a brand-new unordered list. Notice it's data-role still says listview. In addition to the links, I get headings that hold the links and then a paragraph. Now you might look at this and say, wow, that's really not valid HTML. But for jQuery Mobile it is, and it works quite well. So one of the first things I want to do is go ahead and insert all of the links that I need.

So the first link I want is to go to the all page, and that link is going to read 'All tours', and the descriptive text underneath it is going to read 'See all our tour packages'. So you can tell by the link here that jQuery Mobile is going to use IDs of elements to navigate from one place to the other. We're going to go down to the very next one, and we're going to type in 'activities', and we'll replace its link to 'Tours by Activity', and its descriptive text is going to read 'Looking for a specific activity'.

Let's scroll down a little bit more. We'll finish this up by linking the third and last page to region. The link name itself is going to read 'Tours by Region', and the descriptive text is going to read 'Want to go to a specific region'. Fantastic! Now, I want to do one more thing here. In the Page Footer, I want to replace that with a link to a 24-hour contact phone number, and in doing that, we're going to get to experience Dreamweaver's code hinting for jQuery Mobile as well.

So I'm going to go ahead and delete the placeholder content for the footer, and I'm going to go ahead and create a link. So I'm going to say 'a href' and inside that, I'm going to format a telephone number. So I'm just going to type in 'tel://' and then the number '866-555-4310', and what that's going to do for us is in a mobile device when somebody touches that link, it's actually going to switch over to the phone itself, and it's going to bring that phone number up so they can just hit call and dial it.

So that's pretty cool. All right! I'm going to give it a title for accessibility. I'm just going to type in 'Give us a call'. And then finally, I really want this to be not a clickable line of text. I'd like it to be a button, and so one of the things you can do with jQuery Mobile is go ahead and take something like a link, for example, and just make a button out of it by using data-role. So I'm going to type in 'data-role', and I want this data-role again to be a button. I also would love to have an icon on this button as well, so here I'm going to do a data-icon, and I get the list of all the available icons.

Now unfortunately, there is not a telephone. Now you can customize these and make your own, but for this example we're just going to use what they have, and I'll choose the grid, because I think that'll work just fine. All right! I'm going to go ahead and close my link. I'm going to type in 'Contact Us' as the text of the link and then close the link tag. I'm going to go ahead and save that. Now I would love this footer to be on every single page, so I'm just going to copy that link and then paste that inside the Page Footer content for all of my remaining pages.

I also want to go ahead and activate all those links, so again, just working from say the top down, I know that my first one is all the activities in a region. So the first page, page2 here, I'm going to change its ID to all, and I'm going to change its header to 'All Tours'. We'll worry about the content later. Same thing for page3; I'll change it to activities, and I'll just type in 'Tours by Activity'.

And finally, the last page, we'll go ahead and give it an ID of region, and we'll do 'Tours by Region'. Perfect! So we'll go ahead and save that, and again, I just want to test that in my browser, and I can see there is Explore California. There is the Contact Us button. Notice that it went ahead and just formatted that link as a button. There is the little grid icon that we asked for, and the link points to our telephone number. Our navigation takes us to all of the pages that we were looking for. So notice the page header changes to Tours by Region, All Tours.

So now all that we would really need to do is go into each of those individual pages and plug in the content. So the jQuery Mobile integration that Adobe has added to Dreamweaver CS5.5 really does make it extremely easy to build front-ends for your mobile apps; however, without understanding jQuery Mobile, it could be hard to customize UI elements or even know which ones to use. So before we move on, I wanted to show you a great online resource for learning more about jQuery Mobile. So this is jquerymobile.com, and here if you click on the Docs and Demos, it's going to take you to working examples of jQuery demos.

As a matter of fact, if you sort of shrink this down, you can see how well this resource works, even on your phone. So you can go into things like, for example, buttons, and it'll teach you not only how to do the buttons, but it'll show all the different button icons, how to work with those, and what those are going to do for you. So it's a really easy resource to use, and combined with Dreamweaver's code hinting and the widgets that are already integrated into Dreamweaver, it makes it really easy to place one on my page, go to this, and figure out exactly how to customize it.

So now that we've seen jQuery Mobile, we're going to take the next step in building a mobile application by using Dreamweaver to configure our mobile app.

Show transcript

This video is part of

Image for Dreamweaver CS5.5 New Features
Dreamweaver CS5.5 New Features

18 video lessons · 12671 viewers

James Williamson
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dreamweaver CS5.5 New Features.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.