]> git.sur5r.net Git - contagged/blob - scripts/interface/ifxpulsate.js
Fixed JavaScript errors related to Google Maps and IE
[contagged] / scripts / interface / ifxpulsate.js
1 /**\r
2  * Interface Elements for jQuery\r
3  * FX - pulsate\r
4  * \r
5  * http://interface.eyecon.ro\r
6  * \r
7  * Copyright (c) 2006 Stefan Petre\r
8  * Dual licensed under the MIT (MIT-LICENSE.txt) \r
9  * and GPL (GPL-LICENSE.txt) licenses.\r
10  *   \r
11  *\r
12  */\r
13  \r
14 /**\r
15  * @name Bounce\r
16  * @description makes the element to pulsate\r
17  * @param Mixed speed animation speed, integer for miliseconds, string ['slow' | 'normal' | 'fast']\r
18  * @param Integer times how many times to pulsate\r
19  * @param Function callback (optional) A function to be executed whenever the animation completes.\r
20  * @type jQuery\r
21  * @cat Plugins/Interface\r
22  * @author Stefan Petre\r
23  */\r
24 jQuery.fn.Pulsate = function(speed, times, callback) {\r
25         return this.queue('interfaceFX',function(){\r
26                 if (!jQuery.fxCheckTag(this)) {\r
27                         jQuery.dequeue(this, 'interfaceFX');\r
28                         return false;\r
29                 }\r
30                 var fx = new jQuery.fx.Pulsate(this, speed, times, callback);\r
31                 fx.pulse();\r
32         });\r
33 };\r
34 \r
35 jQuery.fx.Pulsate = function (el, speed, times, callback)\r
36 {       \r
37         var z = this;\r
38         z.times = times;\r
39         z.cnt = 1;\r
40         z.el = el;\r
41         z.speed = speed;\r
42         z.callback = callback;\r
43         jQuery(z.el).show();\r
44         z.pulse = function()\r
45         {\r
46                 z.cnt ++;\r
47                 z.e = new jQuery.fx(\r
48                         z.el, \r
49                         jQuery.speed(\r
50                                 z.speed, \r
51                                 function(){\r
52                                         z.ef = new jQuery.fx(\r
53                                                 z.el, \r
54                                                 jQuery.speed(\r
55                                                         z.speed,\r
56                                                         function()\r
57                                                         {\r
58                                                                 if (z.cnt <= z.times)\r
59                                                                         z.pulse();\r
60                                                                 else {\r
61                                                                         jQuery.dequeue(z.el, 'interfaceFX');\r
62                                                                         if (z.callback && z.callback.constructor == Function) {\r
63                                                                                 z.callback.apply(z.el);\r
64                                                                         }\r
65                                                                 }\r
66                                                         }\r
67                                                 ), \r
68                                                 'opacity'\r
69                                         );\r
70                                         z.ef.custom(0,1);\r
71                                 }\r
72                         ), \r
73                         'opacity'\r
74                 );\r
75                 z.e.custom(1,0);\r
76         };\r
77 };\r