cloudfour / SimpleSlideView

A nifty little jQuery or Zepto plugin for the simplest of sliding views.
http://blog.cloudfour.com/simpleslideview/
258 stars 33 forks source link

Normalizing some options now that noZepto #16

Open lyzadanger opened 10 years ago

lyzadanger commented 10 years ago

Hi @tylersticka

I'm seeing a couple of values getting computed for default options that I think are partially vestigial from Zepto. Specifically:

duration:               ($.fx !== null) && ($.fx.cssPrefix !== null) ? $.fx.speeds._default : 400,

and

cssPrefix:              ($.fx !== null) && ($.fx.cssPrefix !== null) ? $.fx.cssPrefix : '',

Not a lot of Google hits for $.fx.cssPrefix but it does appear to be Zepto-related. What are sane defaults for these now that jQuery is the only game in town?

tylersticka commented 10 years ago

This is a great question!

I believe $.fx.speeds._default should be present in jQuery. I believe it was not always present in Zepto, but was added in a later release. I thought it might make sense to default our effect speeds to jQuery's default, but that may not be necessary. In fact, I'm not sure I even checked to see what happens if you pass null as a duration to animate... I'll feel pretty sheepish if it just uses the default!

$.fx.cssPrefix is Zepto-specific. When we use the transform properties later on, Zepto does a little bit of work for us in that it determines the appropriate CSS prefix to use (if any).

If I were you, I would (for now) work on getting the plugin fully functional without the transform properties (just left/right), then we can revisit our recommendations for doing the fancy-schmancy CSS-powered versions (could be cool to use transit if it's included, fallback to animate and left/right if not... or maybe that's an option).