Skip to content

Commit

Permalink
add options for start and ease classnames
Browse files Browse the repository at this point in the history
  • Loading branch information
seanCodes committed Apr 29, 2017
1 parent 0a5b097 commit 288ed0a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Pep has many options. Here they are in their entirety, with their defaults. Need
| axis | `null` | constrain object to either 'x' or 'y' axis. Set to `'auto'` to constrain to either the x or the y axis automatically, depending on the direction in which the user is dragging |
| debug | `false ` | show debug values and events in the lower-righthand corner of page |
| activeClass | `'pep-active'` | class to add to the pep element while dragging |
| startClass | `'pep-start'` | class to add to the pep element when dragging starts. (If a `startThreshold` option is defined then this class is added only after dragging past the threshold.) |
| easeClass | `'pep-ease'` | class to add to the pep element while easing |
| multiplier | `1` | +/- this number to modify to 1:1 ratio of finger/mouse movement to el movement |
| velocityMultiplier | `1.9` | +/- this number to modify the springiness of the object as your release it |
| shouldPreventDefault | `true` | in some cases, we don't want to prevent the default mousedown/touchstart on our Pep object, your call |
Expand Down
10 changes: 6 additions & 4 deletions src/jquery.pep.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
grid: [1,1],
debug: false,
activeClass: 'pep-active',
startClass: 'pep-start',
easeClass: 'pep-ease',
multiplier: 1,
velocityMultiplier: 2.5,
shouldPreventDefault: true,
Expand Down Expand Up @@ -321,7 +323,7 @@
var initialDy = Math.abs(this.startY - curY);
if ( !this.started && ( initialDx > this.options.startThreshold[0] || initialDy > this.options.startThreshold[1] ) ){
this.started = true;
this.$el.addClass('pep-start');
this.$el.addClass(this.options.startClass);
this.options.start.call(this, this.startEvent, this);
}

Expand Down Expand Up @@ -430,8 +432,8 @@
this.easing = true;

// remove our start class
this.$el.removeClass('pep-start')
.addClass('pep-ease');
this.$el.removeClass(this.options.startClass)
.addClass(this.options.easeClass);

// Calculate our drop regions
if ( this.options.droppable ) {
Expand Down Expand Up @@ -824,7 +826,7 @@
// removeActiveClass()
// Removes the active class.
Pep.prototype.removeActiveClass = function() {
this.$el.removeClass( [this.options.activeClass, 'pep-ease'].join(' ') );
this.$el.removeClass( [this.options.activeClass, this.options.easeClass].join(' ') );
};

// handleConstraint();
Expand Down

0 comments on commit 288ed0a

Please sign in to comment.