briangonzalez/jquery.pep.js

useCSSTranslation and Modernizr Custom Build Issue

nilssolanki opened this issue · 0 comments

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)){