Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now

Activating the plug-in with jQuery


From:

Create Navigation Menus with jQuery and Dreamweaver

with Chris Converse

Video: Activating the plug-in with jQuery

Now, to activate the jQuery menu plug-in, we're going to come over to the menu.js file. If your version of Dreamweaver supports these related files up here, you can simply click on this, and we can work right inside of this window. If you don't have the related files here in Dreamweaver you can go to the File menu, choose Open, and then choose the menu.css file inside of the Includes folder, inside of the myMenu folder we created on the Desktop. So now inside of this JavaScript file here, we're going to start with the jQuery document ready structure. So we're going to type dollar sign, beginning and ending parentheses, inside of the parentheses we're going to type document, outside of the parentheses we're going to type ready, beginning and ending parentheses, then a semicolon.
please wait ...
Watch the Online Video Course Create Navigation Menus with jQuery and Dreamweaver
25m 49s Intermediate Aug 09, 2012

Viewers: in countries Watching now:

Find out how to add stylized dropdown menus to your web site using HTML, CSS, and JavaScript. Working in Dreamweaver, author Chris Converse breaks down the menu design process, explaining how to build a menu foundation using unordered lists, establish hierarchy with nested submenus, apply styling using CSS rules, and incorporate dropdown functionality using a jQuery plug-in.

To preview the finished project, visit: http://codifydesign.com/chris/lynda/samples/course-0015

This course was created and produced by Chris Converse. We are honored to host his material in the lynda.com online training library.

Subjects:
Developer Web
Software:
Dreamweaver jQuery
Author:
Chris Converse

Activating the plug-in with jQuery

Now, to activate the jQuery menu plug-in, we're going to come over to the menu.js file. If your version of Dreamweaver supports these related files up here, you can simply click on this, and we can work right inside of this window. If you don't have the related files here in Dreamweaver you can go to the File menu, choose Open, and then choose the menu.css file inside of the Includes folder, inside of the myMenu folder we created on the Desktop. So now inside of this JavaScript file here, we're going to start with the jQuery document ready structure. So we're going to type dollar sign, beginning and ending parentheses, inside of the parentheses we're going to type document, outside of the parentheses we're going to type ready, beginning and ending parentheses, then a semicolon.

Inside of ready we're going to type Function, beginning and ending parentheses, beginning and ending bracket, split that open on the brackets. Now the first thing we want to do is set that unordered list to display type of block so that it becomes visible. So let's start with a dollar sign beginning and ending parentheses, inside of the parentheses two tick marks for string literal, I am going to type .nav_menu, space, .dropmenu, and outside of the parentheses we're going to type .css;, inside we're going to type two tick marks for string literal.

First property is going be 'display', outside of the string literal but still inside of the parentheses, comma, two more tick marks for another string literal, then type 'block'. So we're going to set the display type to block. Let's hit a few returns, now let's activate the menu, dollar sign parentheses, tick marks inside of the parentheses for string literal, '.nav_menu, then a space, then a greater than sign, then space, then ul'.

So what the greater than sign does is it targets the direct children ul that are inside of the .nav_menu class. Outside of the parentheses, .dropmenu, inside of the parentheses, semicolon, beginning and ending bracket. Let's split that open on the brackets, so this becomes a custom jQuery instruction that we can actually assign to objects. Now inside of the dropmenu instruction we can assign a bunch of different parameters.

First one is going to be effect, colon space, two tick marks for string literal, 'slide', then a comma. On the next line speed, we're going to set the speed to 250 milliseconds or quarter per second, and again you can change any of these affects that you want. Let's hit Return. We're going to set a timeout to zero. What that does is how long does the menu take to roll back up once the user rolls off of it.

You can actually have it linger for a second or two if you'd like. Setting timeout to zero means that they'll just scroll back up immediately. Next line, we're going to set non-breaking space to false. If we were to set that to true, the menus would lock down to a certain width, and we would get a lot of text wrapping, but in this case I don't have that happen I just want those to be opened up. And then make sure you don't put a comma after the last item, so we need to have a comma in between each one of the different settings and the last one doesn't get a comma.

And all of these settings are contained within the set of brackets right here. So now we have this in place, let's choose File > Save, and come out of Live View, let me bring this split down here a little bit. Let's go back into Live View, and we should be able to interact with the menus inside of Dreamweaver. So if I rollover the Link 1, I can see the submenu animates open, takes 250 milliseconds to the animate open. Link 2 doesn't have a menu, Link 3 has a menu, and Link 4 has a menu and also has a submenu. So when I go over 4-2, we can see the three links we put inside of that nested list, with 4-2-1, 2, and 3.

Now that our menus work, the only thing we have left to do is to give our users an indication that there's a menu. So we'll see right here links 1, 3, and 4 have the submenus, but we don't see that little arrow here, and under Link 4, Link 4-2 has a menu, but we don't see the indication here as well. So using jQuery in the next movie we're going to add custom classes onto any item that does have a submenu.

Find answers to the most frequently asked questions about Create Navigation Menus with jQuery and Dreamweaver .


Expand all | Collapse all
please wait ...
Q: Where can I find more menu information and plug-ins from menu systems?
A: There is a great article from 1stwebdesigner, "38 jQuery And CSS Drop Down Multi Level Menu Solutions", where they list and explain thirty-eight different plug-ins and techniques.
 
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.

* Estimated file size

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 Create Navigation Menus with jQuery and Dreamweaver.

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


OK

Upgrade to View Courses Offline

login

With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

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 ?

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:

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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Start your FREE 10-day trial

Begin learning software, business, and creative skills—anytime,
anywhere—with video instruction from recognized industry experts.
lynda.com provides
Unlimited access to over 4,000 courses—more than 100,000 video tutorials
Expert-led instruction
On-the-go learning. Watch from your computer, tablet, or mobile device. Switch back and forth as you choose.
Start Your FREE Trial Now
 

A trusted source for knowledge.

 

We provide training to more than 4 million people, and our members tell us that lynda.com helps them stay ahead of software updates, pick up brand-new skills, switch careers, land promotions, and explore new hobbies. What can we help you do?

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.