After many months of stellar work, the jQuery UI team has released version 1.5
of their flagship suite of user-interface widgets, components, and
effects. This release was focused on bringing you a standardized
development API across all of the components, allowing for a more
seamless experience when working with the jQuery UI library.
A very exciting CSS theming application was also released with jQuery UI 1.5, called ThemeRoller. ThemeRoller is an amazing way to customize the style and colors across all of the jQuery UI components. It comes with a few preset styles, as well as allowing you to create your own. Once you are done, it packages your theme into a zip file that contains all of the images and CSS you need.
First, let's start by including the necessary files for jQuery UI: jQuery latest js file, the Flora theme complete stylesheet, and the core UI file. Each of the components is built on top of these files. Here is how to include them:
You may want to download these files and put them on your own server, but this is just fine for our demonstration.
At this point you may include the jquery.ui.all.js script for testing, or include each of the components individually. Here are the components that we are using for this
The component defaults can be overridden by passing in options to the main function. For instance, if we want to make the div drag only horizontally, we can set the axis option to "x" with the following code:
Likewise, the Accordion can be accessed the same way. Here we set a custom option to specify the accordion to slide on the mouseover event:
Some of the components, such as draggable and resizable, can even be combined:
This first makes the div draggable, then adds the resize handles to the div.
Now you should have what you need to start with each of the components! Head to the functional demos page to see in-depth examples of each of the components.
A very exciting CSS theming application was also released with jQuery UI 1.5, called ThemeRoller. ThemeRoller is an amazing way to customize the style and colors across all of the jQuery UI components. It comes with a few preset styles, as well as allowing you to create your own. Once you are done, it packages your theme into a zip file that contains all of the images and CSS you need.
Brief Overview of the jQuery UI Project
The jQuery UI project was originally created to bring you a set of "official" jQuery plugins. Mature components from the plugins repository were pulled together to form the first release of jQuery UI. But since each of these plugins had its own style, having been written by different authors, the first release of the library felt a bit cumbersome when packaged together. With that in mind, the focus of UI 1.5 was on achieving a coherent, standardized API to eliminate much of the differences between the components. Through much time and effort, many bugs and feature requests were addressed along the way as well.Inside Look at jQuery UI Version 1.5
Before starting, I want to make sure you know where the jQuery UI Documentation is located. You may also want to head to the download page to grab the library for yourself. Note that the development bundle is the easiest to get started with.First, let's start by including the necessary files for jQuery UI: jQuery latest js file, the Flora theme complete stylesheet, and the core UI file. Each of the components is built on top of these files. Here is how to include them:
HTML:
- <link rel="stylesheet" href="themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)" />
- <script src="http://code.jquery.com/jquery-latest.js"></script>
- <script src="ui/ui.core.js"></script>
You may want to download these files and put them on your own server, but this is just fine for our demonstration.
At this point you may include the jquery.ui.all.js script for testing, or include each of the components individually. Here are the components that we are using for this
HTML:
- <script src="ui/ui.draggable.js"></script>
- <script src="ui/ui.resizable.js"></script>
- <script src="ui/ui.accordion.js"></script>
Activating Components
Each component has a constructor method, which is the component name. For instance, we can make a div draggable by using thedraggable()
method:The component defaults can be overridden by passing in options to the main function. For instance, if we want to make the div drag only horizontally, we can set the axis option to "x" with the following code:
Likewise, the Accordion can be accessed the same way. Here we set a custom option to specify the accordion to slide on the mouseover event:
JavaScript:
- $("#accordionDemo").accordion({ event: "mouseover" });
- });
Some of the components, such as draggable and resizable, can even be combined:
This first makes the div draggable, then adds the resize handles to the div.
Now you should have what you need to start with each of the components! Head to the functional demos page to see in-depth examples of each of the components.
No comments:
Post a Comment