02.06.2013 Views

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2. What format can these arguments take?<br />

a. They must be strings<br />

b. They must be arrays or objects<br />

c. They may be either strings or integers<br />

d. They must be functions that return the value in string format<br />

Have a go hero – doing more with fadeTo<br />

[ 43 ]<br />

Chapter 2<br />

A great application <strong>of</strong> the fadeTo() method is when it is combined with a modal<br />

overlay. Often when a pop-up dialog is displayed, the underlying page is screened with<br />

a semi-transparent PNG. Instead <strong>of</strong> using an image why not obscure the underlying page by<br />

fading an element that covers the entire visible area <strong>of</strong> the page to semi-transparency instead.<br />

Fading table-rows in Internet Explorer<br />

If we run the previous example in any current version <strong>of</strong> IE (8 or below), we see that the<br />

example fails. Fading elements in IE simply does not work. However, all is not lost,<br />

with just a few tweaks and minor changes to the code we can get the example working<br />

in IE as well.<br />

Time for action – fading table-rows in IE<br />

This time we'll change the script slightly so that it works as intended in Internet Explorer.<br />

1. Change the contents <strong>of</strong> the last element in the fadeTo.html file that<br />

we created in the last example so that it appears like this (new or changed code is<br />

shown in bold):<br />

var messageList = document.getElementById("messageList"),<br />

messages = $("table", messageList),<br />

confirmDiv = $("", {<br />

"class": "confirm",<br />

text: "Really delete?"<br />

}),<br />

remove = $("", {<br />

id: "delete",<br />

text: "Yes"<br />

}).appendTo(confirmDiv),<br />

cancel = $("", {<br />

href: "#",<br />

id: "cancel",

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

Saved successfully!

Ooh no, something went wrong!