| jQuery Tutorials for Designers |
|
jQuery is a great library for animation and Ajax calls. As with any JavaScript library there are different objects and name spaces to learn. Well, over at Web Designer Wall they have put together a good tutorial about using jQuery. The tutorial is written from a designers stand point, but even an experienced hard-core web programmer can find this tutorial useful. Below is an excerpt from the post: First you need to download a copy of jQuery and insert it in your html page (preferably within the Writing jQuery function is relatively easy (thanks to the wonderful documentation). The key point you have to learn is how to get the exact element that you want to apply the effects. Let’s start by doing a simple slide panel. You’ve probably seen a lot of this, where you click on a link and a panel slide up/down. (view demo) When an elment with class="btn-slide" is clicked, it will slideToggle (up/down) the <div id="panel"> element and then toggle a CSS class="active" to the <a class="btn-slide"> element. The .active class will toggle the background position of the arrow image (by CSS). This sample will show you how to make something disappear when an image button is clicked. (view demo) When the <img class="delete"> is clicked, it will find its parent element <div class="pane"> and animate its opacity=hide with slow speed. Now let’s see the power of jQuery’s chainability. With just several lines of code, I can make the box fly around with scaling and fading transition. (view demo) Line 1: when the <a class="run"> is clicked Line 2: animate the <div id="box"> opacity=0.1, left property until it reaches 400px, with speed 1200 (milliseconds) Line 5: then opacity=1, left=0, height=100, width=100, with speed "slow" Line 9: return false will prevent the browser jump to the link anchor Here is a sample of accordion. (view demo) The first line will add a CSS class "active" to the first <H3> element within the <div class="accordion"> (the "active" class will shift the background position of the arrow icon). The second line will hide all the <p> element that is not the first within the <div class="accordion">. When the <h3> element is clicked, it will slideToggle the next <p> and slideUp all its siblings, then toggle the class="active". This example is very similar to accordion#1, but it will let you specify which panel to open as default. (view demo) In the CSS stylesheet, set You can read the full post here. jQuery is one library that I really recommend using. The library is very well written and is pretty easy to learn fairly quickly. If you haven't used the library before this is a good tutorial to start with. |
| < Prev | Next > |
|---|