animate-list.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/Plugin/animate-list", ["exports", "jquery", "Plugin"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(exports, require("jquery"), require("Plugin"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(mod.exports, global.jQuery, global.Plugin);
  11. global.PluginAnimateList = mod.exports;
  12. }
  13. })(this, function (_exports, _jquery, _Plugin2) {
  14. "use strict";
  15. Object.defineProperty(_exports, "__esModule", {
  16. value: true
  17. });
  18. _exports.default = void 0;
  19. _jquery = babelHelpers.interopRequireDefault(_jquery);
  20. _Plugin2 = babelHelpers.interopRequireDefault(_Plugin2);
  21. var NAME = 'animateList';
  22. var AnimateList =
  23. /*#__PURE__*/
  24. function (_Plugin) {
  25. babelHelpers.inherits(AnimateList, _Plugin);
  26. function AnimateList() {
  27. babelHelpers.classCallCheck(this, AnimateList);
  28. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(AnimateList).apply(this, arguments));
  29. }
  30. babelHelpers.createClass(AnimateList, [{
  31. key: "getName",
  32. value: function getName() {
  33. return NAME;
  34. }
  35. }, {
  36. key: "render",
  37. value: function render() {
  38. var $el = this.$el;
  39. var animatedBox =
  40. /*#__PURE__*/
  41. function () {
  42. function animatedBox($el, opts) {
  43. babelHelpers.classCallCheck(this, animatedBox);
  44. this.options = opts;
  45. this.$children = $el.find(opts.child);
  46. this.$children.addClass("animation-".concat(opts.animate));
  47. this.$children.css('animation-fill-mode', opts.fill);
  48. this.$children.css('animation-duration', "".concat(opts.duration, "ms"));
  49. var delay = 0;
  50. var self = this;
  51. this.$children.each(function () {
  52. (0, _jquery.default)(this).css('animation-delay', "".concat(delay, "ms"));
  53. delay += self.options.delay;
  54. });
  55. }
  56. babelHelpers.createClass(animatedBox, [{
  57. key: "run",
  58. value: function run(type) {
  59. var _this = this;
  60. this.$children.removeClass("animation-".concat(this.options.animate));
  61. if (typeof type !== 'undefined') {
  62. this.options.animate = type;
  63. }
  64. setTimeout(function () {
  65. _this.$children.addClass("animation-".concat(_this.options.animate));
  66. }, 0);
  67. }
  68. }]);
  69. return animatedBox;
  70. }();
  71. $el.data('animateList', new animatedBox($el, this.options));
  72. }
  73. }], [{
  74. key: "getDefaults",
  75. value: function getDefaults() {
  76. return {
  77. child: '.panel',
  78. duration: 250,
  79. delay: 50,
  80. animate: 'scale-up',
  81. fill: 'backwards'
  82. };
  83. }
  84. }]);
  85. return AnimateList;
  86. }(_Plugin2.default);
  87. _Plugin2.default.register(NAME, AnimateList);
  88. var _default = AnimateList;
  89. _exports.default = _default;
  90. });