Sha256: 5c133a2efc64d4ae1df6a4e649d1fdf3dd66ddf819835bcc5fe8384ec832ab9f

Contents?: true

Size: 1.3 KB

Versions: 39

Compression:

Stored size: 1.3 KB

Contents

/**
 * Transitionize 0.0.3
 * https://github.com/abpetkov/transitionize
 *
 * Authored by Alexander Petkov
 * https://github.com/abpetkov
 *
 * Copyright 2013, Alexander Petkov
 * License: The MIT License (MIT)
 * http://opensource.org/licenses/MIT
 *
 */

/**
 * Expose `Transitionize`.
 */

module.exports = Transitionize;

/**
 * Initialize new Transitionize.
 *
 * @param {Object} element
 * @param {Object} props
 * @api public
 */

function Transitionize(element, props) {
  if (!(this instanceof Transitionize)) return new Transitionize(element, props);

  this.element = element;
  this.props = props || {};
  this.init();
}

/**
 * Detect if Safari.
 *
 * @returns {Boolean}
 * @api private
 */

Transitionize.prototype.isSafari = function() {
  return (/Safari/).test(navigator.userAgent) && (/Apple Computer/).test(navigator.vendor);
};

/**
 * Loop though the object and push the keys and values in an array.
 * Apply the CSS3 transition to the element and prefix with -webkit- for Safari.
 *
 * @api private
 */

Transitionize.prototype.init = function() {
  var transitions = [];

  for (var key in this.props) {
    transitions.push(key + ' ' + this.props[key]);
  }

  this.element.style.transition = transitions.join(', ');
  if (this.isSafari()) this.element.style.webkitTransition = transitions.join(', ');
};

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
wbase-0.3.20 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.19 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.18 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.17 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.16 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.15 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.14 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.13 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.12 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.11 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.10 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.9 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.8 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.7 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.6 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.5 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.4 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.3 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.2 lib/vendor/admin/transitionize/transitionize.js
wbase-0.3.1 lib/vendor/admin/transitionize/transitionize.js