Skip to content

Instantly share code, notes, and snippets.

@AndrewHaine
Created February 27, 2018 22:02
Show Gist options
  • Save AndrewHaine/d7df93aebaa9aafe2656548f8c4b8edd to your computer and use it in GitHub Desktop.
Save AndrewHaine/d7df93aebaa9aafe2656548f8c4b8edd to your computer and use it in GitHub Desktop.
Common helper functions for front end javascript projects
/**
* A collection of good helper/utility functions
* that may be required in a project
*
* Andrew Haine - 2018
*/
/**
* Using CSS transforms in JavaScript? You'll need to stick some vendor prefixes in there
* @param {Object} el The element to transform
* @param {String} transformation Valid CSS transformation
*/
exports.friendlyTransform = function (el, transformation) {
el.style.msTransform = transformation;
el.style.webkitTransform = transformation;
el.style.MozTransform = transformation;
el.style.OTransform = transformation;
el.style.transform = transformation;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment