Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
jQuery UI 1.10: The User Interface Library for jQuery
jQuery UI 1.10: The User Interface Library for jQuery

jQuery UI 1.10: The User Interface Library for jQuery: Need to learn how to use JQuery UI speedily? Our guide will take you through implementing and customizing each library component in clear, concise steps, all supported by practical examples to make learning faster. , Fourth Edition

eBook
$9.99 $32.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

jQuery UI 1.10: The User Interface Library for jQuery

Chapter 2. The CSS Framework and Other Utilities

Added in Version 1.7, the jQuery UI library contains a refreshed CSS framework that can be used to effectively and consistently theme each widget available in the library. The framework is made up of many helper classes that we can use in our own code, even if we aren't using any of the library components.

In this chapter we'll be covering the following subjects:

  • The files that make up the framework

  • How to use the classes exposed by the framework

  • How to switch themes quickly and easily

  • Overriding the theme

  • Using the position utility

Working with the files that make up the framework


There are two locations within the library's structure where the CSS files that make the framework reside, depending on which version of the library you choose to download.

They are as follows:

  • css: This folder holds the complete CSS framework, including the theme that was selected when the download package was built. All the necessary CSS has been placed in a single, lean and mean stylesheet to minimize the HTTP requests in production environments. The CSS file is stored in a folder, named after the theme selected on the download builder. This version of the framework will contain styles for all the components that were selected in the download builder, so its size will vary depending on how much of the library is being used.

  • themes: Another version of the framework exists within the development-bundle folder, within which you will find the themes folder. Two themes are provided in this folder—the base theme, and whichever theme that was...

Linking to the required framework files


For rapid theming of all jQuery UI widgets in a development environment, we can link to all of the individual files using jquery.ui.all.css:

<link rel="stylesheet"
href="development-bundle/themes/smoothness/jquery.ui.all.css">

To use each file individually when testing a component such as the tabs widget, for example, we would use the following <link> elements:

<link rel="stylesheet"
  href="development-bundle/themes/base/jquery.ui.core.css">
<link rel="stylesheet"
  href="development-bundle/themes/base/jquery.ui.tabs.css">
<link rel="stylesheet"
  href="development-bundle/themes/base/jquery.ui.theme.css">

The CSS resources, when linked to separately, should be added to the HTML page in the following order: core.css, the widget's CSS file, and the theme.css file.

In a production environment, of course, we'd use the super-efficient combined file to minimize the number of HTTP requests for CSS files. We need to link to the combined...

Using the framework classes


Along with using the framework while we're implementing official jQuery UI widgets, we can also use it when we're deploying our own custom plugins.

Working with containers

Containers are recommended because it means that widgets or plugins that we write will be ThemeRoller-ready and easier for end-developers to theme and customize. Let's look at how easy it is to use the framework with our own elements.

In your text editor, create a new file and add the following code:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>CSS Framework - Containers</title>
  <link rel="stylesheet"
    href="development-bundle/themes/base/jquery.ui.all.css">
</head>
<body>
  <div class="ui-widget">
    <div class="ui-widget-header ui-corner-top">
      <h2>This is a .ui-widget-header container</h2>
    </div>
    <div class="ui-widget-content ui-corner-bottom">
      <p>This is...

Switching themes quickly and easily


Once we have developed content using the base theme, we may decide to change the theme to something that fits in better with our overall site theme; thankfully, the CSS framework makes switching themes a painless task. Looking at the previous example, all we need to do to change the skin of the widget is choose a new theme using ThemeRoller (available at http://www.jqueryui.com/themeroller), and then download the new theme. We can download the new theme by selecting all of the components in the download builder and clicking on Download to obtain the theme.

Within the downloaded archive, there will be a directory with the name of the chosen theme, such as redmond. We drag the theme folder out of the archive into the development-bundle\themes folder and link the new theme file from our page, giving our form a completely new look as shown in the following screenshot:

The theme I used to obtain this screenshot is redmond. This uses various shades of blue, either...

The position utility


The position utility is a powerful stand-alone utility that is used to position any element relative to the window, the document, a specific element, or the mouse pointer. It is unique among library components, in that it doesn't require jquery.ui.core.js or jquery.effects.core.js as dependencies.

It exposes no unique or custom methods (other than the position() method), and fires no events, but it does come with a series of configuration options that allow us to use it. These options are listed in the following table:

Option

Format

Used to

at

string

Specify the edges of the element that is being positioned against. Formatted as, for example, left bottom.

collision

string

Move the positioned element to an alternative position when the positioned element overflows its container.

my

string

Specify the edges of the element being positioned that are expected to be aligned to the element being positioned against, for example right top.

of

selector, jQuery, object...

Positioning with a function


We can set the using option to a function, and position the positioned element manually. Change the configuration so that it appears as follows:

$(".ui-positioned-element").position({
  of: ".ui-positioning-element",
  my: "right bottom",
  at: "right bottom",
  using: function(pos) {
    $(this).css({
      backgroundColor: "#fc7676",
      top: pos.top,
      left: pos.left
    });
  }
});

Save this change as positionFunction.html. We supply an anonymous function as the value of the using option. This function is passed as a single argument that is an object containing the properties top and left, which correspond to the values that the element we are positioning should be given.

As you can see from this code, we still need to position the element manually, but the function allows us to do any preprocessing of the element that may be required. Within the function, the this object is set to the element being positioned.

Using the position widget in a real-world example


So far, we've considered the theory behind using the position widget; before moving on to look at the widget factory, let us take a moment to consider how we can use the position widget in a real-world scenario.

A perfect example comes in the shape of jQuery UI's Dialog widget, configured to work as a modal dialog. Here we can use the position widget to place the dialog box on the page in relation to the button's current location.

To see how, add the following code to a new file in your text editor:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Dialog</title>
  <link rel="stylesheet" href="development-bundle/themes/redmond/jquery.ui.all.css">
  <script src="js/jquery-2.0.3.js"></script>
  <script src="development-bundle/ui/jquery.ui.core.js"></script>
  <script src="development-bundle/ui/jquery.ui.widget.js"></script>
  <script src="development...

The widget factory


Another tool within the jQuery UI library is the widget factory, which was introduced in Version 1.8 of jQuery UI, and has since undergone some important changes. This splits the functionality that allows widgets to be easily created into a separate and standalone utility file. This is the jquery.ui.widget.js file, and we can use it to create our very own jQuery UI plugins with ease. Like jQuery itself, which provides the fn.extend() method for easily creating plugins, jQuery UI also provides mechanisms to make plugin creation easier, and to ensure that the common API functionality is retained in new plugins. We will cover the Widget Factory in more detail in a separate chapter that can be downloaded with the book.

Summary


In this chapter, we've seen how the CSS framework consistently styles each of the library components. We've looked at the files that make it and how they work together to provide the complete look-and-feel of the widgets. We also saw how tightly integrated the ThemeRoller application is with the framework, and that it is easy to install or change a theme using ThemeRoller. We also looked at how we can override the theme file if we require a radical customization of a widget that we cannot obtain with ThemeRoller alone.

The chapter also covered building our own widgets or plugins in a way that is compatible with and can make use of the framework, as well as to ensure that our creations are ThemeRoller ready. We can also make use of the helper classes provided by the framework, such as the ui-helper-clearfix class, to quickly implement common CSS solutions.

We also looked at the position utility, which allows us to align any edge of one element with any edge of another element, giving...

Left arrow icon Right arrow icon

Key benefits

  • Packed with clear explanations of how to easily design elegant and powerful frontend interfaces for your web applications
  • A section covering the widget factory including an in-depth example of how to build a custom jQuery UI widget
  • Revised with updated code and targeted at both jQuery UI 1.10 and jQuery 2

Description

jQuery UI, the official UI widget library for jQuery, gives you a solid platform on which to build rich and engaging interfaces quickly, with maximum compatibility, stability, and effort. jQuery UI's ready-made widgets help to reduce the amount of code that you need to write to take a project from conception to completion. jQuery UI 1.10: The User Interface Library for jQuery has been specially revised for Version 1.10 of jQuery UI. It is written to maximize your experience with the library by breaking down each component and walking you through examples that progressively build up your knowledge, taking you from beginner to advanced user in a series of easy-to-follow steps. Throughout the book, you'll learn how to create a basic implementation of each component, then customize and configure the components to tailor them to your application. Each chapter will also show you the custom events fired by the components covered and how these events can be intercepted and acted upon to bring out the best of the library. We will then go on to cover the use of visually engaging, highly configurable user interface widgets. At the end of this book, we'll look at the functioning of all of the UI effects available in the jQuery UI library.

Who is this book for?

This book is for frontend designers and developers who need to learn how to use jQuery UI quickly. To get the most out of this book, you should have a good working knowledge of HTML, CSS, and JavaScript, and should ideally be comfortable using jQuery.

What you will learn

  • Theming of the widgets through the CSS framework
  • Apply themes and widgets to style your interface
  • Configure the different components, including the new Tooltip and Menu widgets
  • Understand the different options that each component uses
  • Learn more about each widget programmatically using its methods and event hooks
  • Add flair to your interface with animation effects
  • Discover advanced functionality supported by the different Tabs

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 26, 2013
Length: 502 pages
Edition : 4th
Language : English
ISBN-13 : 9781782162216
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Dec 26, 2013
Length: 502 pages
Edition : 4th
Language : English
ISBN-13 : 9781782162216
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 153.97
jQuery UI 1.10: The User Interface Library for jQuery
$54.99
Learning jQuery - Fourth Edition
$43.99
jQuery UI Cookbook
$54.99
Total $ 153.97 Stars icon
Banner background image

Table of Contents

14 Chapters
Introducing jQuery UI Chevron down icon Chevron up icon
The CSS Framework and Other Utilities Chevron down icon Chevron up icon
Using the Tabs Widget Chevron down icon Chevron up icon
The Accordion Widget Chevron down icon Chevron up icon
The Dialog Chevron down icon Chevron up icon
The Slider and Progressbar Widgets Chevron down icon Chevron up icon
The Datepicker Widget Chevron down icon Chevron up icon
The Button and Autocomplete Widgets Chevron down icon Chevron up icon
Creating Menus Chevron down icon Chevron up icon
Working with Tooltips Chevron down icon Chevron up icon
Drag and Drop Chevron down icon Chevron up icon
The Resizable Component Chevron down icon Chevron up icon
Selecting and Sorting with jQuery UI Chevron down icon Chevron up icon
UI Effects Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7
(6 Ratings)
5 star 66.7%
4 star 33.3%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




SuJo May 05, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
WOW is right, this book was awesome! This book delivers and doesn't disappoint. Each jQuery UI element is discussed in detail from drag and drop to re-sizing, and my favorite the dialog! They are just so handy if you don't want to cram a bunch of information on a page all at once. This is the first book which I've been able to read that had a more in depth view of using the progress bar elements, and the book starts out right with getting a development environment setup and going. It's no wonder the reviews are starting at 4-5. The book is designed in my favorite "hands on approach" and keeps you going from one UI element to the next. I highly recommend this book, either as a reference for advanced users or a starting point for those whom are new to jQuery and wanting to start making their web sites interactive.The gem, the author also provides all of the code which saves your fingers from typing a lot, I do encourage typing though because it helps with muscle memory, I also liked how the author extended some of the base functionality to show you how you can fully customize the UI experience for your particular interface. 5/5!Publisher Link: [...]
Amazon Verified review Amazon
Sam Jun 01, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Going back 10+ years ago, we were writing very complex Javascript code to handle IE, Netscape browsers, there were some browser detection and cross browser libraries, but those are nothing comparing to the modern UI libraries like jQuery. But it is hard to find good jQuery books and resources that is comprehensive and also practical - this book does both.If you would like to use it as a cookbook - just find the right topic and dive in, if you would like to read it slowly, it covers the entire library.Recommended for every UI developer, and enterprise architects that deals with UI components. Also Packt has great iOS and Android reader apps, I read it on my Samsung Galaxy 10.1 2014 Note tablet and it was a breeze.Sam
Amazon Verified review Amazon
Zippy Jun 06, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Alex Libby, himself the author of five books based on jQuery, HTML5 Video, and CSS, has done a great job updating the fourth edition of Dan Wellman's masterful examination of the jQuery UI library.Two bugbears drive programmers crazy when they face developing anything for the web: JavaScript and user interfaces.JavaScript, described by at least one programmer as "a dog of a language," has quirky, "noisy" syntax, scads of annoying curly braces, function keywords and semicolons, unintuitive type coercion and overloading of +, and on and on.And of course 80 to 90 percent of a programmer's code is devoted to creating a great user interface, regardless of the language.Doing one in JavaScript (in conjunction with, say, CSS) is a universal paradigm now, but can still be frustrating nonetheless.Fortunately, programmers developing interfaces for serving up dynamic web pages have received help from other programmers in the form of JavaScript libraries such as MooTools, Prototype, script.aculo.us, Ext Core, jsPHP, and the most popular of them all, jQuery, in particular the jQuery UI library, which brings us to Libby and Wellman's marvelous book.jQuery UI 1.10: the User Interface Library for jQuery is one of the more comprehensive surveys of the immensely popular realm of jQuery and ready-made widgets. Indeed, Chapter 15 of this book, entitled The Widget Factory, explains how you too can create your own JQuery UI plugins.Knowledge of Javascript knowledge is certainly advised when tackling this book, though the whole nature of jQuery and its ease of use helped spawn a whole generation of semi-literate "script kiddies" who play with published code, linking stretches of Javascript and ready-made widgets together like Legos or some other similar set of building blocks.In any case, this book examines not just widgets and how to make them look attractive via CSS, but also the semi-mysterious world of drag and drop. Everything is laid out for you in a series of examples for each library component, be it a quick, simple, straightforward implementation for those in a hurry or a visual and/or functional customization of each component.This book is highly recommended for anyone who must rely heavily on the jQuery UI library. It can also be found at [...] , where Packtpub offers a rapidly expanding set of books on computer stuff.
Amazon Verified review Amazon
Mindy Swertfeger Apr 10, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've been using jQuery UI for several years now and I found this book to give a complete walkthrough of each of the major components in the library with each of the sections fully explained in terms which are easy to understand. The author gives examples of how each of the widgets function, how to set up the options and attach custom styles and events to enhance their usage.This book is geared towards developers who are versed in HTML, CSS and Javascript. A foreknowledge of jQuery is not a prerequisite however it is helpful in understanding the examples more fully. But a lack of experience in jQuery will not prevent the reader from learing how to implement jQuery UI into their product.For the designer, the largest concern about jQuery UI is the ability to make the styles fit into their designs. This book covers in detail which css classnames control which pieces of the UI for each widget in the library. Also of interest to designers should be the chapter on UI Effects which covers all the possibilities for effects on interactions.
Amazon Verified review Amazon
Luigi Mar 13, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I really appreciated this book, because it's comprehensive about the UI library of jQuery. It is well written and there are many snippets of code that allowed me to better understand the library. It explains how to start with the library, from the download to the configuration of the environment. It also explains the structure of the library. Then, from the 3rd chapter to the 10th chapter, the various widgets of the library are explained. For many of this widgets it's also explained how to configure them and use a custom style. I liked a lot the 11st chapter, that is about the Drag and Drop feature. This feature wasn't very clear to me before reading this book, so reading the 11st chapter I improved my knowledge about this feature of the library.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.