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

Take into account possible CSS transforms on the element #209

Open fabianhijlkema opened 7 years ago

fabianhijlkema commented 7 years ago

In my use case I'm centering pep elements with CSS transform (-50%, -50%), and positioning them absolutely using percentages (I'm doing this outside the plugin). Adding the following changes makes sure that while the elements stay in their relative position while resizing window or parent, they also work nicely with the constraint-option. Without these changes, this doesn't work well. I'm using this option with useCSSTranslation set to false, but it seems to override nicely when set to true.