PageSourceSearch

https://www.talkitoutnc.org/wp-content/plugins/team-grid/libs/jquery.animatecss/jquery.animatecss.js?ver=1.2.9

js talkitoutnc.org collected 2026-09-29 13:10:05 UTC 3,514 bytes, 113 lines download raw bytes

1//
2// jquery.animatecss.js - A micro-plugin for using Animate.css with jQuery.
3//
4// Developed by Cory LaViska for A Beautiful Site, LLC
5//
6// Licensed under the MIT license: http://opensource.org/licenses/MIT
7//
8(function(factory) {
9  if(typeof define === 'function' && define.amd) {
10    // AMD. Register as an anonymous module.
11    define(['jquery'], factory);
12  } else if(typeof module === 'object' && module.exports) {
13    // Node/CommonJS
14    module.exports = function(root, jQuery) {
15      if(jQuery === undefined) {
16        if(typeof window !== 'undefined') {
17          jQuery = require('jquery');
18        } else {
19          jQuery = require('jquery')(root);
20        }
21      }
22      factory(jQuery);
23      return jQuery;
24    };
25  } else {
26    // Browser globals
27    factory(jQuery);
28  }
29}(function($) {
30  'use strict';
31
32  function animate(el, options) {
33    var animationEnd = 'animationend mozAnimationEnd MSAnimationEnd oanimationend webkitAnimationEnd';
34
35    $(el)
36      .addClass('tgr-animated ' + options.animation)
37      // .one() doesn't seem to work as reliably as .on() + .off()
38      .on(animationEnd, function() {
39        $(this).off(animationEnd);
40
41        // Remove classes when animation ends
42        if( !options.infinite ){
43          $(el).removeClass('tgr-animated ' + options.animation);
44        }
45
46        // Run complete callback
47        options.complete.call(el, $(el));
48      });
49  }
50
51  $.fn.animateCSS_TeamGrid = function(animation) {
52    var options = {};
53
54    // Detect signature
55    if(typeof arguments[1] === 'object') {
56      // $(el).animateCSS('animation', options)
57      options = arguments[1];
58    } else if(typeof arguments[1] === 'function') {
59      // $(el).animateCSS('animation', complete)
60      options.complete = arguments[1];
61    } else if(typeof arguments[1] === 'number') {
62      // $(el).animateCSS('animation', duration, [complete])
63      options.duration = arguments[1];
64      if(typeof arguments[2] === 'function') options.complete = arguments[2];
65    }
66
67    // Merge options with defaults
68    options = $.extend(true, {
69      animation: animation,
70      complete: function() {},
71      delay: 0,
72      duration: 1000,
73      infinite: false,
74    }, options);
75
76    // Apply animation to each element
77    $(this).each(function() {
78      var el = this;
79
80      // Set duration
81      if(options.duration) {
82        $(el).css({
83          '-moz-animation-duration': options.duration + 'ms',
84          '-o-animation-duration': options.duration + 'ms',
85          '-webkit-animation-duration': options.duration + 'ms',
86          'animation-duration': options.duration + 'ms'
87        });
88      }
89
90      // Animate it
91      if(options.delay <= 0) {
92        //
93        // Note: using setTimeout with a zero duration causes execution to wait for the next tick,
94        // resulting in a minor performance issue. For example, the following would result in a
95        // quick visual blip in some browsers after the element is made visible but before
96        // animation starts:
97        //
98        //  $(el).property('hidden', false).animateCSS('slideInUp')
99        //
100        // This is why we don't use setTimeout when no delay is desired.
101        //
102        animate(el, options);
103      } else {
104        // Delay before animating
105        setTimeout(function() {
106          animate(el, options);
107        }, options.delay);
108      }
109    });
110
111    return this;
112  };
113}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.