briangonzalez / jquery.pep.js

👟 Pep, a lightweight plugin for kinetic drag on mobile/desktop
http://pep.briangonzalez.org
1.3k stars 178 forks source link

Adds new useBoundingClientRect option #167

Closed Anaphase closed 9 years ago

Anaphase commented 9 years ago

In my application, I scale pep.js elements via CSS transforms. After scaling an element, it is possible to drag it slightly outside of it's constraints because it's width property is technically still the same.

This pull request adds an option (useBoundingClientRect) to use Element.getBoundingClientRect() instead of jQuery's .outerWidth() & .outerHeight() for element dimension retrieval in Pep.prototype.handleConstraint.

The option is set to false by default to preserve current functionality, but you should maybe consider making this default to true since it has very good browser support.