Last change
on this file since 24245 was 24245, checked in by sjb48, 13 years ago |
Oran code for supporting format changes to document.
|
-
Property svn:executable
set to
*
|
File size:
1.2 KB
|
Line | |
---|
1 | <!doctype html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <title>Animate Visual Test : Animate backgroundColor hex</title>
|
---|
5 | <link rel="stylesheet" href="../visual.css" type="text/css" />
|
---|
6 | <link rel="stylesheet" href="../../../themes/base/ui.all.css" type="text/css">
|
---|
7 | <script type="text/javascript" src="../../../jquery-1.4.1.js"></script>
|
---|
8 | <script type="text/javascript" src="../../../ui/jquery.effects.core.js"></script>
|
---|
9 | <script type="text/javascript">
|
---|
10 | function hexFromRGB (r, g, b) {
|
---|
11 | var hex = [
|
---|
12 | r.toString(16),
|
---|
13 | g.toString(16),
|
---|
14 | b.toString(16)
|
---|
15 | ];
|
---|
16 | $.each(hex, function (nr, val) {
|
---|
17 | if (val.length == 1) {
|
---|
18 | hex[nr] = '0' + val;
|
---|
19 | }
|
---|
20 | });
|
---|
21 | return hex.join('').toUpperCase();
|
---|
22 | }
|
---|
23 | function randomColorHex() {
|
---|
24 | return '#' + hexFromRGB(Math.floor(Math.random()*256), Math.floor(Math.random()*256), Math.floor(Math.random()*256));
|
---|
25 | }
|
---|
26 | $(function() {
|
---|
27 | $("#go").click(function() {
|
---|
28 | $("#animate-backgroundColor").stop().animate({ backgroundColor: randomColorHex() }, "fast");
|
---|
29 | });
|
---|
30 | })
|
---|
31 | </script>
|
---|
32 | <style type="text/css">
|
---|
33 | #animate-backgroundColor { width: 100px; height: 100px; background-color: gray; }
|
---|
34 | </style>
|
---|
35 | </head>
|
---|
36 | <body>
|
---|
37 |
|
---|
38 | <div id="animate-backgroundColor"></div>
|
---|
39 |
|
---|
40 | <button id="go">Go</button>
|
---|
41 |
|
---|
42 | </body>
|
---|
43 | </html>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.