mirror of https://github.com/metafizzy/isotope
Filter & sort magical layouts
http://isotope.metafizzy.co
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.0 KiB
101 lines
3.0 KiB
14 years ago
|
---
|
||
|
|
||
|
title: Animating
|
||
|
category: docs
|
||
14 years ago
|
layout: default
|
||
14 years ago
|
toc:
|
||
|
- { title: animationEngine option, anchor: animationengine_option }
|
||
|
- { title: CSS transitions, anchor: css_transitions }
|
||
|
- { title: Variations, anchor: variations }
|
||
14 years ago
|
|
||
|
---
|
||
|
|
||
14 years ago
|
Isotope was developed to take advantage of the best browser features available. For animations, you can use CSS3 transitions and transforms in capable browsers. Isotope provides Javascript animation fall back for lesser browsers.
|
||
14 years ago
|
|
||
|
|
||
14 years ago
|
## animationEngine option
|
||
14 years ago
|
|
||
14 years ago
|
You can control how Isotope handles animation with the [`animationEngine`](options.html#animationengine) option. This option has three values which control whether jQuery applies styles with`.css()` or `.animate()`.
|
||
14 years ago
|
|
||
|
+ `'best-available'`: if browser supports CSS transitions, Isotope uses `.css()`. If not, falls back to using `.animate()`.
|
||
|
+ `'css'`: Isotope uses `.css()`
|
||
|
+ `'jquery'`: Isotope uses `.animate()`
|
||
|
|
||
|
## CSS transitions
|
||
|
|
||
|
To enable animation with CSS transitions, you'll need the following code in your CSS:
|
||
|
|
||
|
{% highlight css %}
|
||
|
|
||
|
.isotope,
|
||
|
.isotope .isotope-item {
|
||
14 years ago
|
/* change duration value to whatever you like */
|
||
14 years ago
|
-webkit-transition-duration: 0.8s;
|
||
|
-moz-transition-duration: 0.8s;
|
||
13 years ago
|
-ms-transition-duration: 0.8s;
|
||
13 years ago
|
-o-transition-duration: 0.8s;
|
||
14 years ago
|
transition-duration: 0.8s;
|
||
|
}
|
||
|
|
||
|
.isotope {
|
||
|
-webkit-transition-property: height, width;
|
||
|
-moz-transition-property: height, width;
|
||
13 years ago
|
-ms-transition-property: height, width;
|
||
13 years ago
|
-o-transition-property: height, width;
|
||
14 years ago
|
transition-property: height, width;
|
||
|
}
|
||
|
|
||
|
.isotope .isotope-item {
|
||
|
-webkit-transition-property: -webkit-transform, opacity;
|
||
|
-moz-transition-property: -moz-transform, opacity;
|
||
13 years ago
|
-ms-transition-property: -ms-transform, opacity;
|
||
13 years ago
|
-o-transition-property: -o-transform, opacity;
|
||
14 years ago
|
transition-property: transform, opacity;
|
||
|
}
|
||
|
|
||
13 years ago
|
/**** disabling Isotope CSS3 transitions ****/
|
||
|
|
||
|
.isotope.no-transition,
|
||
|
.isotope.no-transition .isotope-item,
|
||
|
.isotope .isotope-item.no-transition {
|
||
|
-webkit-transition-duration: 0s;
|
||
|
-moz-transition-duration: 0s;
|
||
|
-ms-transition-duration: 0s;
|
||
|
-o-transition-duration: 0s;
|
||
|
transition-duration: 0s;
|
||
|
}
|
||
|
|
||
14 years ago
|
{% endhighlight %}
|
||
|
|
||
|
## Variations
|
||
|
|
||
|
With these two options you can finely control how animation is handled across browsers.
|
||
|
|
||
|
### Best available (recommended)
|
||
|
|
||
|
Browsers that support CSS transitions will use them. Other browsers will fall back to using jQuery animation.
|
||
|
|
||
|
+ **Add** CSS transition declarations
|
||
|
|
||
|
### Always use jQuery
|
||
|
|
||
|
All browsers will use jQuery animation, regardless of their CSS transition support.
|
||
|
|
||
|
+ `animationEngine : 'jquery'`
|
||
|
+ **No** CSS transition declarations
|
||
|
|
||
|
Never set `animationEngine : 'jquery'` AND add CSS transition declarations. This will cause double-animation in browser that support CSS transitions — which is a bad thing.
|
||
|
|
||
|
### Only CSS transitions
|
||
|
|
||
|
+ `animationEngine: 'css'`
|
||
|
+ **Add** CSS transition declarations
|
||
|
|
||
|
### None
|
||
|
|
||
|
Animation is not enabled in any browser
|
||
|
|
||
|
+ `animationEngine : 'css'`
|
||
|
+ **No** CSS transition declarations
|
||
|
|