Installing jQuery and jQuery UI

The applications we will design and implement in this chapter and the following chapters depend heavily on the jQuery and jQuery UI libraries. These libraries consist mainly of JavaScript files and some cascading style sheets, and images to style the widgets.

These files are served to the web browser as part of the application, and in general, there are two locations where they may be served from:

  1. A (sub)directory on the server that runs CherryPy together with the other files that make up our application.
  2. Or from an external web location like Google's or Microsoft's content delivery networks.

The latter option might be the best choice if your application gets a lot of traffic as these publicly available resources are designed for high availability and can cope with an enormous number of requests. This might seriously reduce the load on your server and thus reduce costs. More information on this can be found on jQuery's download section http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery.

For development purposes it is often better to download the necessary files and serve them from the web server that serves the rest of the application as well. This way we can inspect those files easily when some error occurs or even decide to tweak the contents. If we choose to theme our application in a customized way (see the info box on jQuery UI's themeroller), the cascading style sheets will differ from the standard ones so we will have to serve them from our web server anyway.

In the example code provided with this book, we include both the jQuery and jQuery UI libraries in the static subdirectory of the directory for each chapter. There is also a css subdirectory that contains a set of customized style sheets that are optimized to deliver a visual style that is well readable both in print and onscreen. The version of the jQuery library used in this book is downloaded from http://code.jquery.com/jquery-1.4.2.js. Information on downloading a (possible themed) version of jQuery UI can be found on http://jqueryui.com/download.

Tip

Using jQuery UI's themeroller

The theme used throughout this book is called smoothness and can be downloaded from http://jqueryui.com/themeroller/ by choosing the Gallery tab and clicking the Download button below the Smoothness example. It is even possible to create a completely customized theme based on one of the standard themes by selecting one of the themes from the gallery and then tweaking it in the Roll Your Own tab. Once you're satisfied with the look you can download the result. Check the online documentation at http://jqueryui.com/docs/Getting_Started for all details.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.12.207