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

useCSSTranslation and Modernizr Custom Build Issue #165

Closed nilssolanki closed 7 years ago

nilssolanki commented 9 years ago

You use Modernizr in your code to determine whether css transforms are supported. But if I use a custom Modernizr build without csstransforms, then your code fails and uses the left positioning fallback.

Instead of doing the following (https://github.com/briangonzalez/jquery.pep.js/blob/master/src/jquery.pep.js#L963):

 if ( !this.options.useCSSTranslation || ( typeof(Modernizr) !== "undefined" && !Modernizr.csstransforms)){

You could check if Modernizr has a property csstransforms in the first place before checking the value:

 if ( !this.options.useCSSTranslation || ( typeof(Modernizr) !== "undefined" && Modernizr.hasOwnPropetry('csstransforms') && !Modernizr.csstransforms)){

Or just do a strict check:

 if ( !this.options.useCSSTranslation || ( typeof(Modernizr) !== "undefined" && Modernizr.csstransforms === false)){