diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index a0d09a5..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "browser": true,
- "devel": false,
- "strict": true,
- "undef": true,
- "unused": true,
- "predef": {
- "define": false,
- "module": false,
- "require": false
- }
-}
diff --git a/README.md b/README.md
index 6553c9a..a95895c 100644
--- a/README.md
+++ b/README.md
@@ -24,9 +24,9 @@ Install with [Bower](http://bower.io): `bower install draggabilly`
Link directly to Draggabilly files on [npmcdn.com](https://npmcdn.com).
``` html
-
+
-
+
```
## Usage
diff --git a/bower.json b/bower.json
index 510bc06..277d3db 100644
--- a/bower.json
+++ b/bower.json
@@ -1,11 +1,10 @@
{
"name": "draggabilly",
"main": "draggabilly.js",
- "version": "2.0.1",
"description": "make that shiz draggable",
"dependencies": {
"get-size": "~2.0.2",
- "unidragger": "~2.0.0"
+ "unidragger": "~2.1.0"
},
"devDependencies": {
"qunit": "~1.20",
diff --git a/dist/draggabilly.pkgd.js b/dist/draggabilly.pkgd.js
index c3258d8..bef3db3 100644
--- a/dist/draggabilly.pkgd.js
+++ b/dist/draggabilly.pkgd.js
@@ -1,5 +1,5 @@
/*!
- * Draggabilly PACKAGED v2.0.1
+ * Draggabilly PACKAGED v2.1.0
* Make that shiz draggable
* http://draggabilly.desandro.com
* MIT license
@@ -360,514 +360,149 @@ return getSize;
});
-/*!
- * EventEmitter v4.2.11 - git.io/ee
- * Unlicense - http://unlicense.org/
- * Oliver Caldwell - http://oli.me.uk/
- * @preserve
+/**
+ * EvEmitter v1.0.1
+ * Lil' event emitter
+ * MIT License
*/
-;(function () {
-
-
- /**
- * Class for managing events.
- * Can be extended to provide event functionality in other classes.
- *
- * @class EventEmitter Manages event registering and emitting.
- */
- function EventEmitter() {}
-
- // Shortcuts to improve speed and size
- var proto = EventEmitter.prototype;
- var exports = this;
- var originalGlobalValue = exports.EventEmitter;
-
- /**
- * Finds the index of the listener for the event in its storage array.
- *
- * @param {Function[]} listeners Array of listeners to search through.
- * @param {Function} listener Method to look for.
- * @return {Number} Index of the specified listener, -1 if not found
- * @api private
- */
- function indexOfListener(listeners, listener) {
- var i = listeners.length;
- while (i--) {
- if (listeners[i].listener === listener) {
- return i;
- }
- }
-
- return -1;
- }
-
- /**
- * Alias a method while keeping the context correct, to allow for overwriting of target method.
- *
- * @param {String} name The name of the target method.
- * @return {Function} The aliased method
- * @api private
- */
- function alias(name) {
- return function aliasClosure() {
- return this[name].apply(this, arguments);
- };
- }
-
- /**
- * Returns the listener array for the specified event.
- * Will initialise the event object and listener arrays if required.
- * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
- * Each property in the object response is an array of listener functions.
- *
- * @param {String|RegExp} evt Name of the event to return the listeners from.
- * @return {Function[]|Object} All listener functions for the event.
- */
- proto.getListeners = function getListeners(evt) {
- var events = this._getEvents();
- var response;
- var key;
-
- // Return a concatenated array of all matching events if
- // the selector is a regular expression.
- if (evt instanceof RegExp) {
- response = {};
- for (key in events) {
- if (events.hasOwnProperty(key) && evt.test(key)) {
- response[key] = events[key];
- }
- }
- }
- else {
- response = events[evt] || (events[evt] = []);
- }
-
- return response;
- };
-
- /**
- * Takes a list of listener objects and flattens it into a list of listener functions.
- *
- * @param {Object[]} listeners Raw listener objects.
- * @return {Function[]} Just the listener functions.
- */
- proto.flattenListeners = function flattenListeners(listeners) {
- var flatListeners = [];
- var i;
-
- for (i = 0; i < listeners.length; i += 1) {
- flatListeners.push(listeners[i].listener);
- }
-
- return flatListeners;
- };
-
- /**
- * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
- *
- * @param {String|RegExp} evt Name of the event to return the listeners from.
- * @return {Object} All listener functions for an event in an object.
- */
- proto.getListenersAsObject = function getListenersAsObject(evt) {
- var listeners = this.getListeners(evt);
- var response;
-
- if (listeners instanceof Array) {
- response = {};
- response[evt] = listeners;
- }
-
- return response || listeners;
- };
+/* jshint unused: true, undef: true, strict: true */
- /**
- * Adds a listener function to the specified event.
- * The listener will not be added if it is a duplicate.
- * If the listener returns true then it will be removed after it is called.
- * If you pass a regular expression as the event name then the listener will be added to all events that match it.
- *
- * @param {String|RegExp} evt Name of the event to attach the listener to.
- * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.addListener = function addListener(evt, listener) {
- var listeners = this.getListenersAsObject(evt);
- var listenerIsWrapped = typeof listener === 'object';
- var key;
-
- for (key in listeners) {
- if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
- listeners[key].push(listenerIsWrapped ? listener : {
- listener: listener,
- once: false
- });
- }
- }
-
- return this;
- };
-
- /**
- * Alias of addListener
- */
- proto.on = alias('addListener');
-
- /**
- * Semi-alias of addListener. It will add a listener that will be
- * automatically removed after its first execution.
- *
- * @param {String|RegExp} evt Name of the event to attach the listener to.
- * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.addOnceListener = function addOnceListener(evt, listener) {
- return this.addListener(evt, {
- listener: listener,
- once: true
- });
- };
-
- /**
- * Alias of addOnceListener.
- */
- proto.once = alias('addOnceListener');
-
- /**
- * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
- * You need to tell it what event names should be matched by a regex.
- *
- * @param {String} evt Name of the event to create.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.defineEvent = function defineEvent(evt) {
- this.getListeners(evt);
- return this;
- };
+( function( global, factory ) {
+ // universal module definition
+ /* jshint strict: false */ /* globals define, module */
+ if ( typeof define == 'function' && define.amd ) {
+ // AMD - RequireJS
+ define( 'ev-emitter/ev-emitter',factory );
+ } else if ( typeof module == 'object' && module.exports ) {
+ // CommonJS - Browserify, Webpack
+ module.exports = factory();
+ } else {
+ // Browser globals
+ global.EvEmitter = factory();
+ }
- /**
- * Uses defineEvent to define multiple events.
- *
- * @param {String[]} evts An array of event names to define.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.defineEvents = function defineEvents(evts) {
- for (var i = 0; i < evts.length; i += 1) {
- this.defineEvent(evts[i]);
- }
- return this;
- };
+}( this, function() {
- /**
- * Removes a listener function from the specified event.
- * When passed a regular expression as the event name, it will remove the listener from all events that match it.
- *
- * @param {String|RegExp} evt Name of the event to remove the listener from.
- * @param {Function} listener Method to remove from the event.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.removeListener = function removeListener(evt, listener) {
- var listeners = this.getListenersAsObject(evt);
- var index;
- var key;
-
- for (key in listeners) {
- if (listeners.hasOwnProperty(key)) {
- index = indexOfListener(listeners[key], listener);
-
- if (index !== -1) {
- listeners[key].splice(index, 1);
- }
- }
- }
-
- return this;
- };
- /**
- * Alias of removeListener
- */
- proto.off = alias('removeListener');
-
- /**
- * Adds listeners in bulk using the manipulateListeners method.
- * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
- * You can also pass it a regular expression to add the array of listeners to all events that match it.
- * Yeah, this function does quite a bit. That's probably a bad thing.
- *
- * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
- * @param {Function[]} [listeners] An optional array of listener functions to add.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.addListeners = function addListeners(evt, listeners) {
- // Pass through to manipulateListeners
- return this.manipulateListeners(false, evt, listeners);
- };
- /**
- * Removes listeners in bulk using the manipulateListeners method.
- * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
- * You can also pass it an event name and an array of listeners to be removed.
- * You can also pass it a regular expression to remove the listeners from all events that match it.
- *
- * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
- * @param {Function[]} [listeners] An optional array of listener functions to remove.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.removeListeners = function removeListeners(evt, listeners) {
- // Pass through to manipulateListeners
- return this.manipulateListeners(true, evt, listeners);
- };
+function EvEmitter() {}
- /**
- * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
- * The first argument will determine if the listeners are removed (true) or added (false).
- * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
- * You can also pass it an event name and an array of listeners to be added/removed.
- * You can also pass it a regular expression to manipulate the listeners of all events that match it.
- *
- * @param {Boolean} remove True if you want to remove listeners, false if you want to add.
- * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
- * @param {Function[]} [listeners] An optional array of listener functions to add/remove.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
- var i;
- var value;
- var single = remove ? this.removeListener : this.addListener;
- var multiple = remove ? this.removeListeners : this.addListeners;
-
- // If evt is an object then pass each of its properties to this method
- if (typeof evt === 'object' && !(evt instanceof RegExp)) {
- for (i in evt) {
- if (evt.hasOwnProperty(i) && (value = evt[i])) {
- // Pass the single listener straight through to the singular method
- if (typeof value === 'function') {
- single.call(this, i, value);
- }
- else {
- // Otherwise pass back to the multiple function
- multiple.call(this, i, value);
- }
- }
- }
- }
- else {
- // So evt must be a string
- // And listeners must be an array of listeners
- // Loop over it and pass each one to the multiple method
- i = listeners.length;
- while (i--) {
- single.call(this, evt, listeners[i]);
- }
- }
-
- return this;
- };
+var proto = EvEmitter.prototype;
- /**
- * Removes all listeners from a specified event.
- * If you do not specify an event then all listeners will be removed.
- * That means every event will be emptied.
- * You can also pass a regex to remove all events that match it.
- *
- * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.removeEvent = function removeEvent(evt) {
- var type = typeof evt;
- var events = this._getEvents();
- var key;
-
- // Remove different things depending on the state of evt
- if (type === 'string') {
- // Remove all listeners for the specified event
- delete events[evt];
- }
- else if (evt instanceof RegExp) {
- // Remove all events matching the regex.
- for (key in events) {
- if (events.hasOwnProperty(key) && evt.test(key)) {
- delete events[key];
- }
- }
- }
- else {
- // Remove all listeners in all events
- delete this._events;
- }
-
- return this;
- };
+proto.on = function( eventName, listener ) {
+ if ( !eventName || !listener ) {
+ return;
+ }
+ // set events hash
+ var events = this._events = this._events || {};
+ // set listeners array
+ var listeners = events[ eventName ] = events[ eventName ] || [];
+ // only add once
+ if ( listeners.indexOf( listener ) == -1 ) {
+ listeners.push( listener );
+ }
- /**
- * Alias of removeEvent.
- *
- * Added to mirror the node API.
- */
- proto.removeAllListeners = alias('removeEvent');
-
- /**
- * Emits an event of your choice.
- * When emitted, every listener attached to that event will be executed.
- * If you pass the optional argument array then those arguments will be passed to every listener upon execution.
- * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
- * So they will not arrive within the array on the other side, they will be separate.
- * You can also pass a regular expression to emit to all events that match it.
- *
- * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
- * @param {Array} [args] Optional array of arguments to be passed to each listener.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.emitEvent = function emitEvent(evt, args) {
- var listeners = this.getListenersAsObject(evt);
- var listener;
- var i;
- var key;
- var response;
-
- for (key in listeners) {
- if (listeners.hasOwnProperty(key)) {
- i = listeners[key].length;
-
- while (i--) {
- // If the listener returns true then it shall be removed from the event
- // The function is executed either with a basic call or an apply if there is an args array
- listener = listeners[key][i];
-
- if (listener.once === true) {
- this.removeListener(evt, listener.listener);
- }
-
- response = listener.listener.apply(this, args || []);
-
- if (response === this._getOnceReturnValue()) {
- this.removeListener(evt, listener.listener);
- }
- }
- }
- }
-
- return this;
- };
+ return this;
+};
- /**
- * Alias of emitEvent
- */
- proto.trigger = alias('emitEvent');
-
- /**
- * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
- * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
- *
- * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
- * @param {...*} Optional additional arguments to be passed to each listener.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.emit = function emit(evt) {
- var args = Array.prototype.slice.call(arguments, 1);
- return this.emitEvent(evt, args);
- };
+proto.once = function( eventName, listener ) {
+ if ( !eventName || !listener ) {
+ return;
+ }
+ // add event
+ this.on( eventName, listener );
+ // set once flag
+ // set onceEvents hash
+ var onceEvents = this._onceEvents = this._onceEvents || {};
+ // set onceListeners array
+ var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || [];
+ // set flag
+ onceListeners[ listener ] = true;
+
+ return this;
+};
+
+proto.off = function( eventName, listener ) {
+ var listeners = this._events && this._events[ eventName ];
+ if ( !listeners || !listeners.length ) {
+ return;
+ }
+ var index = listeners.indexOf( listener );
+ if ( index != -1 ) {
+ listeners.splice( index, 1 );
+ }
- /**
- * Sets the current value to check against when executing listeners. If a
- * listeners return value matches the one set here then it will be removed
- * after execution. This value defaults to true.
- *
- * @param {*} value The new value to check for when executing listeners.
- * @return {Object} Current instance of EventEmitter for chaining.
- */
- proto.setOnceReturnValue = function setOnceReturnValue(value) {
- this._onceReturnValue = value;
- return this;
- };
+ return this;
+};
- /**
- * Fetches the current value to check against when executing listeners. If
- * the listeners return value matches this one then it should be removed
- * automatically. It will return true by default.
- *
- * @return {*|Boolean} The current value to check for or the default, true.
- * @api private
- */
- proto._getOnceReturnValue = function _getOnceReturnValue() {
- if (this.hasOwnProperty('_onceReturnValue')) {
- return this._onceReturnValue;
- }
- else {
- return true;
- }
- };
+proto.emitEvent = function( eventName, args ) {
+ var listeners = this._events && this._events[ eventName ];
+ if ( !listeners || !listeners.length ) {
+ return;
+ }
+ var i = 0;
+ var listener = listeners[i];
+ args = args || [];
+ // once stuff
+ var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
+
+ while ( listener ) {
+ var isOnce = onceListeners && onceListeners[ listener ];
+ if ( isOnce ) {
+ // remove listener
+ // remove before trigger to prevent recursion
+ this.off( eventName, listener );
+ // unset once flag
+ delete onceListeners[ listener ];
+ }
+ // trigger listener
+ listener.apply( this, args );
+ // get next listener
+ i += isOnce ? 0 : 1;
+ listener = listeners[i];
+ }
- /**
- * Fetches the events object and creates one if required.
- *
- * @return {Object} The events storage object.
- * @api private
- */
- proto._getEvents = function _getEvents() {
- return this._events || (this._events = {});
- };
+ return this;
+};
- /**
- * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
- *
- * @return {Function} Non conflicting EventEmitter class.
- */
- EventEmitter.noConflict = function noConflict() {
- exports.EventEmitter = originalGlobalValue;
- return EventEmitter;
- };
+return EvEmitter;
- // Expose the class either via AMD, CommonJS or the global object
- if (typeof define === 'function' && define.amd) {
- define('eventEmitter/EventEmitter',[],function () {
- return EventEmitter;
- });
- }
- else if (typeof module === 'object' && module.exports){
- module.exports = EventEmitter;
- }
- else {
- exports.EventEmitter = EventEmitter;
- }
-}.call(this));
+}));
/*!
- * Unipointer v2.0.0
+ * Unipointer v2.1.0
* base class for doing one thing with pointer event
* MIT license
*/
/*jshint browser: true, undef: true, unused: true, strict: true */
-/*global define: false, module: false, require: false */
( function( window, factory ) {
-
// universal module definition
-
+ /* jshint strict: false */ /*global define, module, require */
if ( typeof define == 'function' && define.amd ) {
// AMD
define( 'unipointer/unipointer',[
- 'eventEmitter/EventEmitter'
- ], function( EventEmitter ) {
- return factory( window, EventEmitter );
+ 'ev-emitter/ev-emitter'
+ ], function( EvEmitter ) {
+ return factory( window, EvEmitter );
});
} else if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory(
window,
- require('wolfy87-eventemitter')
+ require('ev-emitter')
);
} else {
// browser global
window.Unipointer = factory(
window,
- window.EventEmitter
+ window.EvEmitter
);
}
-}( window, function factory( window, EventEmitter ) {
+}( window, function factory( window, EvEmitter ) {
@@ -875,8 +510,8 @@ function noop() {}
function Unipointer() {}
-// inherit EventEmitter
-var proto = Unipointer.prototype = Object.create( EventEmitter.prototype );
+// inherit EvEmitter
+var proto = Unipointer.prototype = Object.create( EvEmitter.prototype );
proto.bindStartEvent = function( elem ) {
this._bindStartEvent( elem, true );
@@ -1140,7 +775,7 @@ return Unipointer;
}));
/*!
- * Unidragger v2.0.0
+ * Unidragger v2.1.0
* Draggable base class
* MIT license
*/
@@ -1148,9 +783,8 @@ return Unipointer;
/*jshint browser: true, unused: true, undef: true, strict: true */
( function( window, factory ) {
- /*global define: false, module: false, require: false */
-
// universal module definition
+ /*jshint strict: false */ /*globals define, module, require */
if ( typeof define == 'function' && define.amd ) {
// AMD
@@ -1185,7 +819,7 @@ function noop() {}
function Unidragger() {}
-// inherit Unipointer & EventEmitter
+// inherit Unipointer & EvEmitter
var proto = Unidragger.prototype = Object.create( Unipointer.prototype );
// ----- bind start ----- //
@@ -1426,15 +1060,17 @@ return Unidragger;
}));
/*!
- * Draggabilly v2.0.1
+ * Draggabilly v2.1.0
* Make that shiz draggable
* http://draggabilly.desandro.com
* MIT license
*/
-( function( window, factory ) {
-
+/*jshint browser: true, strict: true, undef: true, unused: true */
+( function( window, factory ) {
+ // universal module definition
+ /* jshint strict: false */ /*globals define, module, require */
if ( typeof define == 'function' && define.amd ) {
// AMD
define( [
@@ -1444,7 +1080,7 @@ return Unidragger;
function( getSize, Unidragger ) {
return factory( window, getSize, Unidragger );
});
- } else if ( typeof exports == 'object' ) {
+ } else if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory(
window,
@@ -1485,21 +1121,17 @@ function isElement( obj ) {
// -------------------------- requestAnimationFrame -------------------------- //
-// https://gist.github.com/1866474
-
-// get rAF and cAF, prefixed, if present
+// get rAF, prefixed, if present
var requestAnimationFrame = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
+// fallback to setTimeout
var lastTime = 0;
-// fallback to setTimeout and clearTimeout if either request/cancel is not supported
if ( !requestAnimationFrame ) {
requestAnimationFrame = function( callback ) {
var currTime = new Date().getTime();
var timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) );
- var id = setTimeout( function() {
- callback( currTime + timeToCall );
- }, timeToCall );
+ var id = setTimeout( callback, timeToCall );
lastTime = currTime + timeToCall;
return id;
};
@@ -1507,13 +1139,9 @@ if ( !requestAnimationFrame ) {
// -------------------------- support -------------------------- //
-var transformProperty = ( function () {
- var style = document.documentElement.style;
- if ( typeof style.transform == 'string' ) {
- return 'transform';
- }
- return 'WebkitTransform';
-})();
+var docElem = document.documentElement;
+var transformProperty = typeof docElem.style.transform == 'string' ?
+ 'transform' : 'WebkitTransform';
var jQuery = window.jQuery;
@@ -1582,7 +1210,7 @@ proto.setHandles = function() {
};
/**
- * emits events via eventEmitter and jQuery events
+ * emits events via EvEmitter and jQuery events
* @param {String} type - name of event
* @param {Event} event - original event
* @param {Array} args - extra arguments
@@ -1607,14 +1235,11 @@ proto.dispatchEvent = function( type, event, args ) {
// -------------------------- position -------------------------- //
-// get left/top position from style
-proto._getPosition = function() {
- // properties
+// get x/y position from style
+Draggabilly.prototype._getPosition = function() {
var style = getComputedStyle( this.element );
-
- var x = parseInt( style.left, 10 );
- var y = parseInt( style.top, 10 );
-
+ var x = this._getPositionCoord( style.left, 'width' );
+ var y = this._getPositionCoord( style.top, 'height' );
// clean up 'auto' or other non-integer values
this.position.x = isNaN( x ) ? 0 : x;
this.position.y = isNaN( y ) ? 0 : y;
@@ -1622,6 +1247,16 @@ proto._getPosition = function() {
this._addTransformPosition( style );
};
+Draggabilly.prototype._getPositionCoord = function( styleSide, measure ) {
+ if ( styleSide.indexOf('%') != -1 ) {
+ // convert percent into pixel for Safari, #75
+ var parentSize = getSize( this.element.parentNode );
+ return ( parseFloat( styleSide ) / 100 ) * parentSize[ measure ];
+ }
+
+ return parseInt( styleSide, 10 );
+};
+
// add transform: translate( x, y ) to position
proto._addTransformPosition = function( style ) {
var transform = style[ transformProperty ];
diff --git a/dist/draggabilly.pkgd.min.js b/dist/draggabilly.pkgd.min.js
index 1651206..c982e61 100644
--- a/dist/draggabilly.pkgd.min.js
+++ b/dist/draggabilly.pkgd.min.js
@@ -1,8 +1,8 @@
/*!
- * Draggabilly PACKAGED v2.0.1
+ * Draggabilly PACKAGED v2.1.0
* Make that shiz draggable
* http://draggabilly.desandro.com
* MIT license
*/
-!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(n){e(t,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){function n(n,r,a){function h(t,e,i){var o,r="$()."+n+'("'+e+'")';return t.each(function(t,h){var d=a.data(h,n);if(!d)return void s(n+" not initialized. Cannot call methods, i.e. "+r);var u=d[e];if(!u||"_"==e.charAt(0))return void s(r+" is not a valid method");var c=u.apply(d,i);o=void 0===o?c:o}),void 0!==o?o:t}function d(t,e){t.each(function(t,i){var o=a.data(i,n);o?(o.option(e),o._init()):(o=new r(i,e),a.data(i,n,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[n]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return d(this,t),this},i(a))}function i(t){!t||t&&t.bridget||(t.bridget=n)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return i(e||t.jQuery),n}),function(t,e){"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){function t(t){var e=parseFloat(t),n=-1==t.indexOf("%")&&!isNaN(e);return n&&e}function e(){}function n(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;d>e;e++){var n=h[e];t[n]=0}return t}function i(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function o(){if(!u){u=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var n=document.body||document.documentElement;n.appendChild(e);var o=i(e);r.isBoxSizeOuter=s=200==t(o.width),n.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=i(e);if("none"==r.display)return n();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var u=a.isBorderBox="border-box"==r.boxSizing,c=0;d>c;c++){var f=h[c],p=r[f],l=parseFloat(p);a[f]=isNaN(l)?0:l}var g=a.paddingLeft+a.paddingRight,v=a.paddingTop+a.paddingBottom,m=a.marginLeft+a.marginRight,y=a.marginTop+a.marginBottom,E=a.borderLeftWidth+a.borderRightWidth,b=a.borderTopWidth+a.borderBottomWidth,P=u&&s,_=t(r.width);_!==!1&&(a.width=_+(P?0:g+E));var x=t(r.height);return x!==!1&&(a.height=x+(P?0:v+b)),a.innerWidth=a.width-(g+E),a.innerHeight=a.height-(v+b),a.outerWidth=a.width+m,a.outerHeight=a.height+y,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],d=h.length,u=!1;return r}),function(){function t(){}function e(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var i=t.prototype,o=this,r=o.EventEmitter;i.getListeners=function(t){var e,n,i=this._getEvents();if(t instanceof RegExp){e={};for(n in i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n])}else e=i[t]||(i[t]=[]);return e},i.flattenListeners=function(t){var e,n=[];for(e=0;e3||Math.abs(t.y)>3},o.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]),this._dragPointerUp(t,e)},o._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},o._dragStart=function(t,n){this.isDragging=!0,this.dragStartPoint=e.getPointerPoint(n),this.isPreventingClicks=!0,this.dragStart(t,n)},o.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},o._dragMove=function(t,e,n){this.isDragging&&this.dragMove(t,e,n)},o.dragMove=function(t,e,n){t.preventDefault(),this.emitEvent("dragMove",[t,e,n])},o._dragEnd=function(t,e){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,e)},o.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},o.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},o._staticClick=function(t,e){if(!this.isIgnoringMouseUp||"mouseup"!=t.type){var n=t.target.nodeName;("INPUT"==n||"TEXTAREA"==n)&&t.target.focus(),this.staticClick(t,e),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400))}},o.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},i.getPointerPoint=e.getPointerPoint,i}),function(t,e){"function"==typeof define&&define.amd?define(["get-size/get-size","unidragger/unidragger"],function(n,i){return e(t,n,i)}):"object"==typeof exports?module.exports=e(t,require("get-size"),require("unidragger")):t.Draggabilly=e(t,t.getSize,t.Unidragger)}(window,function(t,e,n){function i(){}function o(t,e){for(var n in e)t[n]=e[n];return t}function r(t){return t instanceof HTMLElement}function s(t,e){this.element="string"==typeof t?h.querySelector(t):t,f&&(this.$element=f(this.element)),this.options=o({},this.constructor.defaults),this.option(e),this._create()}function a(t,e,n){return n=n||"round",e?Math[n](t/e)*e:t}var h=t.document,d=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame,u=0;d||(d=function(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-u)),i=setTimeout(function(){t(e+n)},n);return u=e+n,i});var c=function(){var t=h.documentElement.style;return"string"==typeof t.transform?"transform":"WebkitTransform"}(),f=t.jQuery,p=s.prototype=Object.create(n.prototype);return s.defaults={},p.option=function(t){o(this.options,t)},p._create=function(){this.position={},this._getPosition(),this.startPoint={x:0,y:0},this.dragPoint={x:0,y:0},this.startPosition=o({},this.position);var t=getComputedStyle(this.element);"relative"!=t.position&&"absolute"!=t.position&&(this.element.style.position="relative"),this.enable(),this.setHandles()},p.setHandles=function(){this.handles=this.options.handle?this.element.querySelectorAll(this.options.handle):[this.element],this.bindHandles()},p.dispatchEvent=function(e,n,i){var o=[n].concat(i);this.emitEvent(e,o);var r=t.jQuery;if(r&&this.$element)if(n){var s=r.Event(n);s.type=e,this.$element.trigger(s,i)}else this.$element.trigger(e,i)},p._getPosition=function(){var t=getComputedStyle(this.element),e=parseInt(t.left,10),n=parseInt(t.top,10);this.position.x=isNaN(e)?0:e,this.position.y=isNaN(n)?0:n,this._addTransformPosition(t)},p._addTransformPosition=function(t){var e=t[c];if(0===e.indexOf("matrix")){var n=e.split(","),i=0===e.indexOf("matrix3d")?12:4,o=parseInt(n[i],10),r=parseInt(n[i+1],10);this.position.x+=o,this.position.y+=r}},p.pointerDown=function(t,e){this._dragPointerDown(t,e);var n=h.activeElement;n&&n.blur&&n!=h.body&&n.blur(),this._bindPostStartEvents(t),this.element.classList.add("is-pointer-down"),this.dispatchEvent("pointerDown",t,[e])},p.pointerMove=function(t,e){var n=this._dragPointerMove(t,e);this.dispatchEvent("pointerMove",t,[e,n]),this._dragMove(t,e,n)},p.dragStart=function(t,e){this.isEnabled&&(this._getPosition(),this.measureContainment(),this.startPosition.x=this.position.x,this.startPosition.y=this.position.y,this.setLeftTop(),this.dragPoint.x=0,this.dragPoint.y=0,this.element.classList.add("is-dragging"),this.dispatchEvent("dragStart",t,[e]),this.animate())},p.measureContainment=function(){var t=this.options.containment;if(t){var n=r(t)?t:"string"==typeof t?h.querySelector(t):this.element.parentNode,i=e(this.element),o=e(n),s=this.element.getBoundingClientRect(),a=n.getBoundingClientRect(),d=o.borderLeftWidth+o.borderRightWidth,u=o.borderTopWidth+o.borderBottomWidth,c=this.relativeStartPosition={x:s.left-(a.left+o.borderLeftWidth),y:s.top-(a.top+o.borderTopWidth)};this.containSize={width:o.width-d-c.x-i.width,height:o.height-u-c.y-i.height}}},p.dragMove=function(t,e,n){if(this.isEnabled){var i=n.x,o=n.y,r=this.options.grid,s=r&&r[0],h=r&&r[1];i=a(i,s),o=a(o,h),i=this.containDrag("x",i,s),o=this.containDrag("y",o,h),i="y"==this.options.axis?0:i,o="x"==this.options.axis?0:o,this.position.x=this.startPosition.x+i,this.position.y=this.startPosition.y+o,this.dragPoint.x=i,this.dragPoint.y=o,this.dispatchEvent("dragMove",t,[e,n])}},p.containDrag=function(t,e,n){if(!this.options.containment)return e;var i="x"==t?"width":"height",o=this.relativeStartPosition[t],r=a(-o,n,"ceil"),s=this.containSize[i];return s=a(s,n,"floor"),Math.min(s,Math.max(r,e))},p.pointerUp=function(t,e){this.element.classList.remove("is-pointer-down"),this.dispatchEvent("pointerUp",t,[e]),this._dragPointerUp(t,e)},p.dragEnd=function(t,e){this.isEnabled&&(c&&(this.element.style[c]="",this.setLeftTop()),this.element.classList.remove("is-dragging"),this.dispatchEvent("dragEnd",t,[e]))},p.animate=function(){if(this.isDragging){this.positionDrag();var t=this;d(function(){t.animate()})}},p.setLeftTop=function(){this.element.style.left=this.position.x+"px",this.element.style.top=this.position.y+"px"},p.positionDrag=function(){this.element.style[c]="translate3d( "+this.dragPoint.x+"px, "+this.dragPoint.y+"px, 0)"},p.staticClick=function(t,e){this.dispatchEvent("staticClick",t,[e])},p.enable=function(){this.isEnabled=!0},p.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},p.destroy=function(){this.disable(),this.element.style[c]="",this.element.style.left="",this.element.style.top="",this.element.style.position="",this.unbindHandles(),this.$element&&this.$element.removeData("draggabilly")},p._init=i,f&&f.bridget&&f.bridget("draggabilly",s),s});
\ No newline at end of file
+!function(t,i){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(e){i(t,e)}):"object"==typeof module&&module.exports?module.exports=i(t,require("jquery")):t.jQueryBridget=i(t,t.jQuery)}(window,function(t,i){function e(e,r,a){function h(t,i,n){var o,r="$()."+e+'("'+i+'")';return t.each(function(t,h){var d=a.data(h,e);if(!d)return void s(e+" not initialized. Cannot call methods, i.e. "+r);var u=d[i];if(!u||"_"==i.charAt(0))return void s(r+" is not a valid method");var p=u.apply(d,n);o=void 0===o?p:o}),void 0!==o?o:t}function d(t,i){t.each(function(t,n){var o=a.data(n,e);o?(o.option(i),o._init()):(o=new r(n,i),a.data(n,e,o))})}a=a||i||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[e]=function(t){if("string"==typeof t){var i=o.call(arguments,1);return h(this,t,i)}return d(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=e)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(i||t.jQuery),e}),function(t,i){"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return i()}):"object"==typeof module&&module.exports?module.exports=i():t.getSize=i()}(window,function(){function t(t){var i=parseFloat(t),e=-1==t.indexOf("%")&&!isNaN(i);return e&&i}function i(){}function e(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},i=0;d>i;i++){var e=h[i];t[e]=0}return t}function n(t){var i=getComputedStyle(t);return i||a("Style returned "+i+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),i}function o(){if(!u){u=!0;var i=document.createElement("div");i.style.width="200px",i.style.padding="1px 2px 3px 4px",i.style.borderStyle="solid",i.style.borderWidth="1px 2px 3px 4px",i.style.boxSizing="border-box";var e=document.body||document.documentElement;e.appendChild(i);var o=n(i);r.isBoxSizeOuter=s=200==t(o.width),e.removeChild(i)}}function r(i){if(o(),"string"==typeof i&&(i=document.querySelector(i)),i&&"object"==typeof i&&i.nodeType){var r=n(i);if("none"==r.display)return e();var a={};a.width=i.offsetWidth,a.height=i.offsetHeight;for(var u=a.isBorderBox="border-box"==r.boxSizing,p=0;d>p;p++){var c=h[p],f=r[c],g=parseFloat(f);a[c]=isNaN(g)?0:g}var l=a.paddingLeft+a.paddingRight,v=a.paddingTop+a.paddingBottom,m=a.marginLeft+a.marginRight,y=a.marginTop+a.marginBottom,b=a.borderLeftWidth+a.borderRightWidth,P=a.borderTopWidth+a.borderBottomWidth,E=u&&s,_=t(r.width);_!==!1&&(a.width=_+(E?0:l+b));var x=t(r.height);return x!==!1&&(a.height=x+(E?0:v+P)),a.innerWidth=a.width-(l+b),a.innerHeight=a.height-(v+P),a.outerWidth=a.width+m,a.outerHeight=a.height+y,a}}var s,a="undefined"==typeof console?i:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],d=h.length,u=!1;return r}),function(t,i){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",i):"object"==typeof module&&module.exports?module.exports=i():t.EvEmitter=i()}(this,function(){function t(){}var i=t.prototype;return i.on=function(t,i){if(t&&i){var e=this._events=this._events||{},n=e[t]=e[t]||[];return-1==n.indexOf(i)&&n.push(i),this}},i.once=function(t,i){if(t&&i){this.on(t,i);var e=this._onceEvents=this._onceEvents||{},n=e[t]=e[t]||[];return n[i]=!0,this}},i.off=function(t,i){var e=this._events&&this._events[t];if(e&&e.length){var n=e.indexOf(i);return-1!=n&&e.splice(n,1),this}},i.emitEvent=function(t,i){var e=this._events&&this._events[t];if(e&&e.length){var n=0,o=e[n];i=i||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,i),n+=s?0:1,o=e[n]}return this}},t}),function(t,i){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(e){return i(t,e)}):"object"==typeof module&&module.exports?module.exports=i(t,require("ev-emitter")):t.Unipointer=i(t,t.EvEmitter)}(window,function(t,i){function e(){}function n(){}var o=n.prototype=Object.create(i.prototype);o.bindStartEvent=function(t){this._bindStartEvent(t,!0)},o.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},o._bindStartEvent=function(i,e){e=void 0===e?!0:!!e;var n=e?"addEventListener":"removeEventListener";t.navigator.pointerEnabled?i[n]("pointerdown",this):t.navigator.msPointerEnabled?i[n]("MSPointerDown",this):(i[n]("mousedown",this),i[n]("touchstart",this))},o.handleEvent=function(t){var i="on"+t.type;this[i]&&this[i](t)},o.getTouch=function(t){for(var i=0;i3||Math.abs(t.y)>3},o.pointerUp=function(t,i){this.emitEvent("pointerUp",[t,i]),this._dragPointerUp(t,i)},o._dragPointerUp=function(t,i){this.isDragging?this._dragEnd(t,i):this._staticClick(t,i)},o._dragStart=function(t,e){this.isDragging=!0,this.dragStartPoint=i.getPointerPoint(e),this.isPreventingClicks=!0,this.dragStart(t,e)},o.dragStart=function(t,i){this.emitEvent("dragStart",[t,i])},o._dragMove=function(t,i,e){this.isDragging&&this.dragMove(t,i,e)},o.dragMove=function(t,i,e){t.preventDefault(),this.emitEvent("dragMove",[t,i,e])},o._dragEnd=function(t,i){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,i)},o.dragEnd=function(t,i){this.emitEvent("dragEnd",[t,i])},o.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},o._staticClick=function(t,i){if(!this.isIgnoringMouseUp||"mouseup"!=t.type){var e=t.target.nodeName;("INPUT"==e||"TEXTAREA"==e)&&t.target.focus(),this.staticClick(t,i),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400))}},o.staticClick=function(t,i){this.emitEvent("staticClick",[t,i])},n.getPointerPoint=i.getPointerPoint,n}),function(t,i){"function"==typeof define&&define.amd?define(["get-size/get-size","unidragger/unidragger"],function(e,n){return i(t,e,n)}):"object"==typeof module&&module.exports?module.exports=i(t,require("get-size"),require("unidragger")):t.Draggabilly=i(t,t.getSize,t.Unidragger)}(window,function(t,i,e){function n(){}function o(t,i){for(var e in i)t[e]=i[e];return t}function r(t){return t instanceof HTMLElement}function s(t,i){this.element="string"==typeof t?h.querySelector(t):t,f&&(this.$element=f(this.element)),this.options=o({},this.constructor.defaults),this.option(i),this._create()}function a(t,i,e){return e=e||"round",i?Math[e](t/i)*i:t}var h=t.document,d=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame,u=0;d||(d=function(t){var i=(new Date).getTime(),e=Math.max(0,16-(i-u)),n=setTimeout(t,e);return u=i+e,n});var p=h.documentElement,c="string"==typeof p.style.transform?"transform":"WebkitTransform",f=t.jQuery,g=s.prototype=Object.create(e.prototype);return s.defaults={},g.option=function(t){o(this.options,t)},g._create=function(){this.position={},this._getPosition(),this.startPoint={x:0,y:0},this.dragPoint={x:0,y:0},this.startPosition=o({},this.position);var t=getComputedStyle(this.element);"relative"!=t.position&&"absolute"!=t.position&&(this.element.style.position="relative"),this.enable(),this.setHandles()},g.setHandles=function(){this.handles=this.options.handle?this.element.querySelectorAll(this.options.handle):[this.element],this.bindHandles()},g.dispatchEvent=function(i,e,n){var o=[e].concat(n);this.emitEvent(i,o);var r=t.jQuery;if(r&&this.$element)if(e){var s=r.Event(e);s.type=i,this.$element.trigger(s,n)}else this.$element.trigger(i,n)},s.prototype._getPosition=function(){var t=getComputedStyle(this.element),i=this._getPositionCoord(t.left,"width"),e=this._getPositionCoord(t.top,"height");this.position.x=isNaN(i)?0:i,this.position.y=isNaN(e)?0:e,this._addTransformPosition(t)},s.prototype._getPositionCoord=function(t,e){if(-1!=t.indexOf("%")){var n=i(this.element.parentNode);return parseFloat(t)/100*n[e]}return parseInt(t,10)},g._addTransformPosition=function(t){var i=t[c];if(0===i.indexOf("matrix")){var e=i.split(","),n=0===i.indexOf("matrix3d")?12:4,o=parseInt(e[n],10),r=parseInt(e[n+1],10);this.position.x+=o,this.position.y+=r}},g.pointerDown=function(t,i){this._dragPointerDown(t,i);var e=h.activeElement;e&&e.blur&&e!=h.body&&e.blur(),this._bindPostStartEvents(t),this.element.classList.add("is-pointer-down"),this.dispatchEvent("pointerDown",t,[i])},g.pointerMove=function(t,i){var e=this._dragPointerMove(t,i);this.dispatchEvent("pointerMove",t,[i,e]),this._dragMove(t,i,e)},g.dragStart=function(t,i){this.isEnabled&&(this._getPosition(),this.measureContainment(),this.startPosition.x=this.position.x,this.startPosition.y=this.position.y,this.setLeftTop(),this.dragPoint.x=0,this.dragPoint.y=0,this.element.classList.add("is-dragging"),this.dispatchEvent("dragStart",t,[i]),this.animate())},g.measureContainment=function(){var t=this.options.containment;if(t){var e=r(t)?t:"string"==typeof t?h.querySelector(t):this.element.parentNode,n=i(this.element),o=i(e),s=this.element.getBoundingClientRect(),a=e.getBoundingClientRect(),d=o.borderLeftWidth+o.borderRightWidth,u=o.borderTopWidth+o.borderBottomWidth,p=this.relativeStartPosition={x:s.left-(a.left+o.borderLeftWidth),y:s.top-(a.top+o.borderTopWidth)};this.containSize={width:o.width-d-p.x-n.width,height:o.height-u-p.y-n.height}}},g.dragMove=function(t,i,e){if(this.isEnabled){var n=e.x,o=e.y,r=this.options.grid,s=r&&r[0],h=r&&r[1];n=a(n,s),o=a(o,h),n=this.containDrag("x",n,s),o=this.containDrag("y",o,h),n="y"==this.options.axis?0:n,o="x"==this.options.axis?0:o,this.position.x=this.startPosition.x+n,this.position.y=this.startPosition.y+o,this.dragPoint.x=n,this.dragPoint.y=o,this.dispatchEvent("dragMove",t,[i,e])}},g.containDrag=function(t,i,e){if(!this.options.containment)return i;var n="x"==t?"width":"height",o=this.relativeStartPosition[t],r=a(-o,e,"ceil"),s=this.containSize[n];return s=a(s,e,"floor"),Math.min(s,Math.max(r,i))},g.pointerUp=function(t,i){this.element.classList.remove("is-pointer-down"),this.dispatchEvent("pointerUp",t,[i]),this._dragPointerUp(t,i)},g.dragEnd=function(t,i){this.isEnabled&&(c&&(this.element.style[c]="",this.setLeftTop()),this.element.classList.remove("is-dragging"),this.dispatchEvent("dragEnd",t,[i]))},g.animate=function(){if(this.isDragging){this.positionDrag();var t=this;d(function(){t.animate()})}},g.setLeftTop=function(){this.element.style.left=this.position.x+"px",this.element.style.top=this.position.y+"px"},g.positionDrag=function(){this.element.style[c]="translate3d( "+this.dragPoint.x+"px, "+this.dragPoint.y+"px, 0)"},g.staticClick=function(t,i){this.dispatchEvent("staticClick",t,[i])},g.enable=function(){this.isEnabled=!0},g.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},g.destroy=function(){this.disable(),this.element.style[c]="",this.element.style.left="",this.element.style.top="",this.element.style.position="",this.unbindHandles(),this.$element&&this.$element.removeData("draggabilly")},g._init=n,f&&f.bridget&&f.bridget("draggabilly",s),s});
\ No newline at end of file
diff --git a/draggabilly.js b/draggabilly.js
index 74b12fd..8029c3d 100644
--- a/draggabilly.js
+++ b/draggabilly.js
@@ -1,13 +1,15 @@
/*!
- * Draggabilly v2.0.1
+ * Draggabilly v2.1.0
* Make that shiz draggable
* http://draggabilly.desandro.com
* MIT license
*/
-( function( window, factory ) {
- 'use strict';
+/*jshint browser: true, strict: true, undef: true, unused: true */
+( function( window, factory ) {
+ // universal module definition
+ /* jshint strict: false */ /*globals define, module, require */
if ( typeof define == 'function' && define.amd ) {
// AMD
define( [
@@ -17,7 +19,7 @@
function( getSize, Unidragger ) {
return factory( window, getSize, Unidragger );
});
- } else if ( typeof exports == 'object' ) {
+ } else if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory(
window,
@@ -58,21 +60,17 @@ function isElement( obj ) {
// -------------------------- requestAnimationFrame -------------------------- //
-// https://gist.github.com/1866474
-
-// get rAF and cAF, prefixed, if present
+// get rAF, prefixed, if present
var requestAnimationFrame = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
+// fallback to setTimeout
var lastTime = 0;
-// fallback to setTimeout and clearTimeout if either request/cancel is not supported
if ( !requestAnimationFrame ) {
requestAnimationFrame = function( callback ) {
var currTime = new Date().getTime();
var timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) );
- var id = setTimeout( function() {
- callback( currTime + timeToCall );
- }, timeToCall );
+ var id = setTimeout( callback, timeToCall );
lastTime = currTime + timeToCall;
return id;
};
@@ -80,13 +78,9 @@ if ( !requestAnimationFrame ) {
// -------------------------- support -------------------------- //
-var transformProperty = ( function () {
- var style = document.documentElement.style;
- if ( typeof style.transform == 'string' ) {
- return 'transform';
- }
- return 'WebkitTransform';
-})();
+var docElem = document.documentElement;
+var transformProperty = typeof docElem.style.transform == 'string' ?
+ 'transform' : 'WebkitTransform';
var jQuery = window.jQuery;
@@ -155,7 +149,7 @@ proto.setHandles = function() {
};
/**
- * emits events via eventEmitter and jQuery events
+ * emits events via EvEmitter and jQuery events
* @param {String} type - name of event
* @param {Event} event - original event
* @param {Array} args - extra arguments
diff --git a/gulpfile.js b/gulpfile.js
index ffd79ff..6d0eb18 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -140,22 +140,23 @@ var chalk = require('chalk');
gulp.task( 'version', function() {
var args = minimist( process.argv.slice(3) );
var version = args.t;
- if ( !version || !/\d\.\d\.\d/.test( version ) ) {
+ if ( !version || !/^\d+\.\d+\.\d+/.test( version ) ) {
gutil.log( 'invalid version: ' + chalk.red( version ) );
return;
}
gutil.log( 'ticking version to ' + chalk.green( version ) );
gulp.src('draggabilly.js')
- .pipe( replace( /Draggabilly v\d\.\d\.\d/, 'Draggabilly v' + version ) )
+ .pipe( replace( /Draggabilly v\d+\.\d+\.\d+/, 'Draggabilly v' + version ) )
.pipe( gulp.dest('.') );
- gulp.src( [ 'bower.json', 'package.json' ] )
- .pipe( replace( /"version": "\d\.\d\.\d"/, '"version": "' + version + '"' ) )
+ gulp.src('package.json')
+ .pipe( replace( /"version": "\d+\.\d+\.\d+"/, '"version": "' + version + '"' ) )
.pipe( gulp.dest('.') );
// replace CDN links in README
+ var minorVersion = version.match(/\d+\.\d+/)[0];
gulp.src('README.md')
- .pipe( replace( /draggabilly@\d\.\d\.\d/g, 'draggabilly@' + version ) )
+ .pipe( replace( /draggabilly@\d+\.\d+/g, 'draggabilly@' + minorVersion ) )
.pipe( gulp.dest('.') );
});
diff --git a/package.json b/package.json
index 13350b6..19fa2cf 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "draggabilly",
- "version": "2.0.1",
+ "version": "2.1.0",
"description": "make that shiz draggable",
"main": "draggabilly.js",
"dependencies": {
"get-size": "~2.0.2",
- "unidragger": "~2.0.0"
+ "unidragger": "~2.1.0"
},
"devDependencies": {
"chalk": "^1.1.1",
diff --git a/sandbox/sandbox.html b/sandbox/sandbox.html
index 0ddbf9a..2583c81 100644
--- a/sandbox/sandbox.html
+++ b/sandbox/sandbox.html
@@ -155,7 +155,7 @@