jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of

02.06.2013 Views

The fadeTo() method is used in the following way: jQuery(elements).fadeTo(duration, ending-opacity, [easing], [callback]); [ 37 ] Chapter 2 Animating to partial opacity In this example we have a table in which certain rows can be removed. When one of the rows is selected for removal by the user, we can animate the row to partial opacity while requesting confirmation of the removal. In this section we will cover the following topics: The required arguments of the fadeTo() method Setting a specific ending opacity A work-around for fading table-rows in IE Once a table row has been faded, it will appear like this: The middle row of the table shown in the previous screenshot has been faded to 50 % opacity.

Fading Animations Time for action – creating the example page This example requires significantly more HTML than before, although we still add this, as well as the styling first. 1. Begin by adding the following example markup to our template file: Private Messages RecievedSubjectFromDelete TodayRe: tomorrowBobx TodayRe: tomorrowBill x TodayRe: tomorrow x YesterdayRe: tomorrow x YesterdayRe: tomorrow x 2. Save this page as fadeTo.html in the main project folder. 3. To create the stylesheet for this example, add the following code in a new file in your text editor: #messageList { width:540px; padding:10px 20px; margin:auto; font:normal 14px "Nimbus Sans L", "Helvetica Neue", "Franklin Gothic Medium", Sans-serif; background-color:#666; border:1px solid #aaa; -moz-border-radius:7px; -webkit-border-radius:7px; border-radius:7px; } #messageList header { color:#eee; padding-left:10px; font-size:20px; } [ 38 ]

The fadeTo() method is used in the following way:<br />

<strong>jQuery</strong>(elements).fadeTo(duration, ending-opacity, [easing],<br />

[callback]);<br />

[ 37 ]<br />

Chapter 2<br />

Animating to partial opacity<br />

In this example we have a table in which certain rows can be removed. When one <strong>of</strong> the<br />

rows is selected for removal by the user, we can animate the row to partial opacity while<br />

requesting confirmation <strong>of</strong> the removal. In this section we will cover the following topics:<br />

The required arguments <strong>of</strong> the fadeTo() method<br />

Setting a specific ending opacity<br />

A work-around for fading table-rows in IE<br />

Once a table row has been faded, it will appear like this:<br />

The middle row <strong>of</strong> the table shown in the previous screenshot has been faded<br />

to 50 % opacity.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!