├── .gitattributes ├── README.md ├── .gitignore ├── index.html └── js └── jquery.custom-animations.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jquery-custom-animations 2 | ======================== 3 | 4 | Some nice custom animations, similar to jQuery UI Effects but works standalone. 5 | 6 | Available effects: 7 | 8 | - `flash` - Fades the element in and out 9 | - `wiggle` - Shakes the element from left to right and vice versa 10 | - `zap` - "Zooms" the element in or out (like if the TV-shuts down) 11 | 12 | - `fadeToToggle` - Extended `fadeTo` function, to toggle the fadeTo value 13 | - `slideFadeToggle` - Toggles the height and opacity at once (nothing special) 14 | 15 | - `blowToggle` - Blows the element in or out 16 | - `blowIn` - Blows the element in 17 | - `blowOut` - Blows the element out 18 | 19 | - `blindTopToggle` - Moves the element from the top in our out 20 | - `blindtopIn` - Moves the element from the top in 21 | - `blindTopOut` - Moves the element to the top out 22 | 23 | - `blindRightToggle` - Moves the element from the right in our out 24 | - `blindRightIn` - Moves the element from the right in 25 | - `blindRightOut` - Moves the element to the right out 26 | 27 | - `blindBottomToggle` - Moves the element from the bottom in our out 28 | - `blindBottomIn` - Moves the element from the bottom in 29 | - `blindBottomOut` - Moves the element to the bottom out 30 | 31 | - `blindLeftToggle` - Moves the element from the left in our out 32 | - `blindLeftIn` - Moves the element from the left in 33 | - `blindLeftOut` - Moves the element to the left out 34 | 35 | ###License 36 | Copyright (c) 2012 Yannick Albert ([http://yckart.com/](http://yckart.com/)) 37 | 38 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 39 | 40 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 41 | 42 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 43 | 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | *_i.c 48 | *_p.c 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.vspscc 63 | .builds 64 | *.dotCover 65 | 66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 67 | #packages/ 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | 80 | # ReSharper is a .NET coding add-in 81 | _ReSharper* 82 | 83 | # Installshield output folder 84 | [Ee]xpress 85 | 86 | # DocProject is a documentation generator add-in 87 | DocProject/buildhelp/ 88 | DocProject/Help/*.HxT 89 | DocProject/Help/*.HxC 90 | DocProject/Help/*.hhc 91 | DocProject/Help/*.hhk 92 | DocProject/Help/*.hhp 93 | DocProject/Help/Html2 94 | DocProject/Help/html 95 | 96 | # Click-Once directory 97 | publish 98 | 99 | # Others 100 | [Bb]in 101 | [Oo]bj 102 | sql 103 | TestResults 104 | *.Cache 105 | ClientBin 106 | stylecop.* 107 | ~$* 108 | *.dbmdl 109 | Generated_Code #added for RIA/Silverlight projects 110 | 111 | # Backup & report files from converting an old project file to a newer 112 | # Visual Studio version. Backup files are not needed, because we have git ;-) 113 | _UpgradeReport_Files/ 114 | Backup*/ 115 | UpgradeLog*.XML 116 | 117 | 118 | 119 | ############ 120 | ## Windows 121 | ############ 122 | 123 | # Windows image file caches 124 | Thumbs.db 125 | 126 | # Folder config file 127 | Desktop.ini 128 | 129 | 130 | ############# 131 | ## Python 132 | ############# 133 | 134 | *.py[co] 135 | 136 | # Packages 137 | *.egg 138 | *.egg-info 139 | dist 140 | build 141 | eggs 142 | parts 143 | bin 144 | var 145 | sdist 146 | develop-eggs 147 | .installed.cfg 148 | 149 | # Installer logs 150 | pip-log.txt 151 | 152 | # Unit test / coverage reports 153 | .coverage 154 | .tox 155 | 156 | #Translations 157 | *.mo 158 | 159 | #Mr Developer 160 | .mr.developer.cfg 161 | 162 | # Mac crap 163 | .DS_Store 164 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery custom animations 6 | 7 | 50 | 51 | 52 | 53 | 54 |

jQuery custom animations

55 | 56 |
57 |
Foo Bar
58 |
59 | 60 |
61 | 62 | 63 | 64 |
65 | 66 |
67 | 68 | 69 |
70 | 71 |
72 | 73 | 74 | 75 |
76 | 77 |
78 | 79 | 80 | 81 |
82 | 83 |
84 | 85 | 86 | 87 |
88 | 89 |
90 | 91 | 92 | 93 |
94 | 95 |
96 | 97 | 98 | 99 |
100 | 101 | 102 | 103 | 104 | 237 | 238 | -------------------------------------------------------------------------------- /js/jquery.custom-animations.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jquery.custom-animations.js 0.1 3 | * https://github.com/yckart/jquery-custom-animations 4 | * 5 | * 6 | * Copyright (c) 2012 Yannick Albert (http://yckart.com) 7 | * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). 8 | * 2013/02/08 9 | **/ 10 | 11 | 12 | /*! 13 | * @param {number} times - The number of fades 14 | * @param {number} duration - The speed amount 15 | * @param {string} easing - The easing method 16 | * @param {function} complete - A callback function 17 | **/ 18 | jQuery.fn.flash = function (times, duration, easing, complete) { 19 | times = (times || 2) * 2; 20 | while(times--){ 21 | this.animate({ 22 | opacity: !(times % 2) 23 | }, duration, easing, complete); 24 | } 25 | return this; 26 | }; 27 | 28 | 29 | 30 | /*! 31 | * @param {number} times - The number of shakes 32 | * @param {number} duration - The speed amount 33 | * @param {string} easing - The easing method 34 | * @param {function} complete - A callback function 35 | **/ 36 | jQuery.fn.wiggle = function (times, duration, easing, complete) { 37 | var self = this; 38 | 39 | if (times > 0) { 40 | this.animate({ 41 | marginLeft: times-- % 2 === 0 ? -15 : 15 42 | }, duration, easing, function () { 43 | self.wiggle(times, duration, easing, complete); 44 | }); 45 | } else { 46 | this.animate({ 47 | marginLeft: 0 48 | }, duration, easing, function () { 49 | if (jQuery.isFunction(complete)) { 50 | complete(); 51 | } 52 | }); 53 | } 54 | return this; 55 | }; 56 | 57 | 58 | 59 | /*! 60 | * @param {number} duration - The speed amount 61 | * @param {string} easing - The easing method 62 | * @param {function} complete - A callback function 63 | **/ 64 | jQuery.fn.zap = function (duration, easing, complete) { 65 | return this.css({ 66 | overflow: 'hidden' 67 | }).animate({ 68 | padding: 'toggle', 69 | width: 'toggle', 70 | height: 'toggle', 71 | margin: this.outerHeight() / 2 === parseFloat(this.css('marginTop')) || this.outerWidth() / 2 === parseFloat(this.css('marginLeft')) ? 0 : this.outerHeight() / 2 + ' ' + this.outerWidth() / 2 72 | }, jQuery.speed(duration, easing, complete)); 73 | }; 74 | 75 | 76 | 77 | /*! 78 | * @param {number} duration - The speed amount 79 | * @param {number} to - The opacity value to toggle 80 | * @param {string} easing - The easing method 81 | * @param {function} complete - A callback function 82 | **/ 83 | jQuery.fn.fadeToToggle = function (duration, to, easing, complete) { 84 | return this.animate({ 85 | opacity: parseFloat(this.css('opacity')) < 1 ? 1 : to 86 | }, jQuery.speed(duration, easing, complete)); 87 | }; 88 | 89 | 90 | 91 | /*! 92 | * @param {number} duration - The speed amount 93 | * @param {string} easing - The easing method 94 | * @param {function} complete - A callback function 95 | **/ 96 | jQuery.fn.slideFadeToggle = function (duration, easing, complete) { 97 | return this.animate({ 98 | opacity: 'toggle', 99 | height: 'toggle' 100 | }, jQuery.speed(duration, easing, complete)); 101 | }; 102 | 103 | 104 | /*! 105 | * @param {number} duration - The speed amount 106 | * @param {string} easing - The easing method 107 | * @param {function} complete - A callback function 108 | **/ 109 | jQuery.fn.blowToggle = function (duration, easing, complete) { 110 | return this.animate({ 111 | zoom: parseFloat(this.css('zoom')) < 4 ? 4 : 1, 112 | opacity: parseFloat(this.css('opacity')) < 1 ? 1 : 0 113 | }, jQuery.speed(duration, easing, complete)); 114 | }; 115 | 116 | /*! 117 | * @param {number} duration - The speed amount 118 | * @param {string} easing - The easing method 119 | * @param {function} complete - A callback function 120 | **/ 121 | jQuery.fn.blowOut = function (duration, easing, complete) { 122 | return this.animate({ 123 | zoom: 8, 124 | opacity: 0 125 | }, jQuery.speed(duration, easing, complete)); 126 | }; 127 | 128 | /*! 129 | * @param {number} duration - The speed amount 130 | * @param {string} easing - The easing method 131 | * @param {function} complete - A callback function 132 | **/ 133 | jQuery.fn.blowIn = function (duration, easing, complete) { 134 | return this.animate({ 135 | zoom: 1, 136 | opacity: 1 137 | }, jQuery.speed(duration, easing, complete)); 138 | }; 139 | 140 | 141 | 142 | /*! 143 | * @param {number} duration - The speed amount 144 | * @param {string} easing - The easing method 145 | * @param {function} complete - A callback function 146 | **/ 147 | jQuery.fn.blindLeftToggle = function (duration, easing, complete) { 148 | return this.animate({ 149 | marginLeft: parseFloat(this.css('marginLeft')) < 0 ? 0 : -this.outerWidth() 150 | }, jQuery.speed(duration, easing, complete)); 151 | }; 152 | 153 | /*! 154 | * @param {number} duration - The speed amount 155 | * @param {string} easing - The easing method 156 | * @param {function} complete - A callback function 157 | **/ 158 | jQuery.fn.blindLeftOut = function (duration, easing, complete) { 159 | return this.animate({ 160 | marginLeft: -this.outerWidth() 161 | }, jQuery.speed(duration, easing, complete)); 162 | }; 163 | 164 | /*! 165 | * @param {number} duration - The speed amount 166 | * @param {string} easing - The easing method 167 | * @param {function} complete - A callback function 168 | **/ 169 | jQuery.fn.blindLeftIn = function (duration, easing, complete) { 170 | return this.animate({ 171 | marginLeft: 0 172 | }, jQuery.speed(duration, easing, complete)); 173 | }; 174 | 175 | 176 | 177 | /*! 178 | * @param {number} duration - The speed amount 179 | * @param {string} easing - The easing method 180 | * @param {function} complete - A callback function 181 | **/ 182 | jQuery.fn.blindRightToggle = function (duration, easing, complete) { 183 | return this.animate({ 184 | marginLeft: -(parseFloat(this.css('marginLeft'))) < 0 ? 0 : this.outerWidth() 185 | }, jQuery.speed(duration, easing, complete)); 186 | }; 187 | 188 | /*! 189 | * @param {number} duration - The speed amount 190 | * @param {string} easing - The easing method 191 | * @param {function} complete - A callback function 192 | **/ 193 | jQuery.fn.blindRightOut = function (duration, easing, complete) { 194 | return this.animate({ 195 | marginLeft: this.outerWidth() 196 | }, jQuery.speed(duration, easing, complete)); 197 | }; 198 | 199 | /*! 200 | * @param {number} duration - The speed amount 201 | * @param {string} easing - The easing method 202 | * @param {function} complete - A callback function 203 | **/ 204 | jQuery.fn.blindRightIn = function (duration, easing, complete) { 205 | return this.animate({ 206 | marginLeft: 0 207 | }, jQuery.speed(duration, easing, complete)); 208 | }; 209 | 210 | 211 | 212 | /*! 213 | * @param {number} duration - The speed amount 214 | * @param {string} easing - The easing method 215 | * @param {function} complete - A callback function 216 | **/ 217 | jQuery.fn.blindUpToggle = function (duration, easing, complete) { 218 | return this.animate({ 219 | marginTop: parseFloat(this.css('marginTop')) < 0 ? 0 : -this.outerHeight() 220 | }, jQuery.speed(duration, easing, complete)); 221 | }; 222 | 223 | /*! 224 | * @param {number} duration - The speed amount 225 | * @param {string} easing - The easing method 226 | * @param {function} complete - A callback function 227 | **/ 228 | jQuery.fn.blindUpOut = function (duration, easing, complete) { 229 | return this.animate({ 230 | marginTop: -this.outerHeight() 231 | }, jQuery.speed(duration, easing, complete)); 232 | }; 233 | 234 | /*! 235 | * @param {number} duration - The speed amount 236 | * @param {string} easing - The easing method 237 | * @param {function} complete - A callback function 238 | **/ 239 | jQuery.fn.blindUpIn = function (duration, easing, complete) { 240 | return this.animate({ 241 | marginTop: 0 242 | }, jQuery.speed(duration, easing, complete)); 243 | }; 244 | 245 | 246 | 247 | /*! 248 | * @param {number} duration - The speed amount 249 | * @param {string} easing - The easing method 250 | * @param {function} complete - A callback function 251 | **/ 252 | jQuery.fn.blindDownToggle = function (duration, easing, complete) { 253 | return this.animate({ 254 | marginTop: -parseFloat(this.css('marginTop')) < 0 ? 0 : this.outerHeight() 255 | }, jQuery.speed(duration, easing, complete)); 256 | }; 257 | 258 | /*! 259 | * @param {number} duration - The speed amount 260 | * @param {string} easing - The easing method 261 | * @param {function} complete - A callback function 262 | **/ 263 | jQuery.fn.blindDownOut = function (duration, easing, complete) { 264 | return this.animate({ 265 | marginTop: this.outerHeight() 266 | }, jQuery.speed(duration, easing, complete)); 267 | }; 268 | 269 | /*! 270 | * @param {number} duration - The speed amount 271 | * @param {string} easing - The easing method 272 | * @param {function} complete - A callback function 273 | **/ 274 | jQuery.fn.blindDownIn = function (duration, easing, complete) { 275 | return this.animate({ 276 | marginTop: 0 277 | }, jQuery.speed(duration, easing, complete)); 278 | }; --------------------------------------------------------------------------------