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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Canvas, IE, and the alternatives<br />

Our flag example will work in IE9, but not in any previous version. If we run the previous<br />

example in IE8 or lower, we'll see the fallback content consisting <strong>of</strong> a paragraph <strong>of</strong><br />

explanatory text:<br />

[ 277 ]<br />

Chapter 10<br />

The fallback mechanism for the HTML5 element is simple but effective. Any<br />

browser that doesn't understand the element simply displays any elements that are<br />

contained within it, while supporting browsers do not show any <strong>of</strong> its content except what<br />

we draw using the JavaScript API.<br />

There is an easy way that we can allow our flag to work in older versions <strong>of</strong> IE thanks to the<br />

explorercanvas library created by Google. IE uses a proprietary technology called Vector<br />

Markup Language (VML) which is similar (but much older than and now deprecated) to the<br />

. In fact it was Micros<strong>of</strong>t's alternative technology to Scalable Vector Graphics<br />

(SVG) but can also be used as a simple approximation.<br />

Using the explorercanvas library is almost as simple as downloading it and then referencing<br />

it in the page on which the appears, but there is a subtle change that we need to<br />

make to our code.<br />

The explorercanvas library can be downloaded from Google's code<br />

repository at http://code.google.com/p/explorercanvas/.<br />

API methods that simply do not work<br />

The explorercanvas library does not port all canvas functionality to IE. A couple <strong>of</strong> methods<br />

and techniques simply will not work. These include:<br />

The clearRect() method will not work in IE<br />

Radial gradients do not work in IE<br />

Non-uniform scaling does not work correctly

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

Saved successfully!

Ooh no, something went wrong!