animating.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Animating &middot; Isotope Docs</title>
  6. <!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
  7. <link rel="stylesheet" href="../css/style.css" />
  8. <!-- scripts at bottom of page -->
  9. </head>
  10. <body class="docs ">
  11. <nav id="site-nav">
  12. <h1><a href="../index.html">Isotope</a></h1>
  13. <h2>Docs</h2>
  14. <ul>
  15. <li><a href="../docs/introduction.html">Introduction</a>
  16. <li><a href="../docs/options.html">Options</a>
  17. <li><a href="../docs/methods.html">Methods</a>
  18. <li><a href="../docs/layout-modes.html">Layout modes</a>
  19. <li><a href="../docs/filtering.html">Filtering</a>
  20. <li><a href="../docs/sorting.html">Sorting</a>
  21. <li class="current"><a href="#content">Animating</a>
  22. <ul class="toc">
  23. <li><a href="#animationengine_option">animationEngine option</a></li>
  24. <li><a href="#css_transitions">CSS transitions</a></li>
  25. <li><a href="#variations">Variations</a></li>
  26. </ul>
  27. </li>
  28. <li><a href="../docs/adding-items.html">Adding items</a>
  29. <li><a href="../docs/extending-isotope.html">Extending Isotope</a>
  30. <li><a href="../docs/hash-history-jquery-bbq.html">Hash history with jQuery BBQ</a>
  31. <li><a href="../docs/help.html">Help</a>
  32. <li><a href="../docs/license.html">License</a>
  33. </ul>
  34. <h2>Demos</h2>
  35. <ul>
  36. <li><a href="../demos/basic.html">Basic</a>
  37. <li><a href="../demos/elements-complete.html">Elements Complete</a>
  38. <li><a href="../demos/elements-partial.html">Elements Partial</a>
  39. <li><a href="../demos/layout-modes.html">Layout modes</a>
  40. <li><a href="../demos/filtering.html">Filtering</a>
  41. <li><a href="../demos/sorting.html">Sorting</a>
  42. <li><a href="../demos/relayout.html">reLayout</a>
  43. <li><a href="../demos/adding-items.html">Adding items</a>
  44. <li><a href="../demos/infinite-scroll.html">Infinite Scroll</a>
  45. <li><a href="../demos/images.html">Images</a>
  46. <li><a href="../demos/combination-filters.html">Combination filters</a>
  47. <li><a href="../demos/hash-history.html">Hash history</a>
  48. <li><a href="../demos/fluid-responsive.html">Fluid / responsive</a>
  49. </ul>
  50. <h2>Custom layout modes</h2>
  51. <ul>
  52. <li><a href="../custom-layout-modes/centered-masonry.html">Centered Masonry</a>
  53. <li><a href="../custom-layout-modes/category-rows.html">Category rows</a>
  54. <li><a href="../custom-layout-modes/masonry-corner-stamp.html">Masonry corner stamp</a>
  55. <li><a href="../custom-layout-modes/masonry-gutters.html">Masonry gutters</a>
  56. <li><a href="../custom-layout-modes/spine-align.html">Spine align</a>
  57. </ul>
  58. <h2><a href="../tests/index.html">Tests</a></h2>
  59. </nav> <!-- #site-nav -->
  60. <section id="content">
  61. <h1>Animating</h1>
  62. <p>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.</p>
  63. <h2 id='animationengine_option'>animationEngine option</h2>
  64. <p>You can control how Isotope handles animation with the <a href='options.html#animationengine'><code>animationEngine</code></a> option. This option has three values which control whether jQuery applies styles with<code>.css()</code> or <code>.animate()</code>.</p>
  65. <ul>
  66. <li><code>&#39;best-available&#39;</code>: if browser supports CSS transitions, Isotope uses <code>.css()</code>. If not, falls back to using <code>.animate()</code>.</li>
  67. <li><code>&#39;css&#39;</code>: Isotope uses <code>.css()</code></li>
  68. <li><code>&#39;jquery&#39;</code>: Isotope uses <code>.animate()</code></li>
  69. </ul>
  70. <h2 id='css_transitions'>CSS transitions</h2>
  71. <p>To enable animation with CSS transitions, you&#8217;ll need the following code in your CSS:</p>
  72. <div class='highlight'><pre><code class='css'><span class='nc'>.isotope</span><span class='o'>,</span>
  73. <span class='nc'>.isotope</span> <span class='nc'>.isotope-item</span> <span class='p'>{</span>
  74. <span class='c'>/* change duration value to whatever you like */</span>
  75. <span class='o'>-</span><span class='n'>webkit</span><span class='o'>-</span><span class='n'>transition</span><span class='o'>-</span><span class='n'>duration</span><span class='o'>:</span> <span class='m'>0.8s</span><span class='p'>;</span>
  76. <span class='o'>-</span><span class='n'>moz</span><span class='o'>-</span><span class='n'>transition</span><span class='o'>-</span><span class='n'>duration</span><span class='o'>:</span> <span class='m'>0.8s</span><span class='p'>;</span>
  77. <span class='n'>transition</span><span class='o'>-</span><span class='n'>duration</span><span class='o'>:</span> <span class='m'>0.8s</span><span class='p'>;</span>
  78. <span class='p'>}</span>
  79. <span class='nc'>.isotope</span> <span class='p'>{</span>
  80. <span class='o'>-</span><span class='n'>webkit</span><span class='o'>-</span><span class='n'>transition</span><span class='o'>-</span><span class='n'>property</span><span class='o'>:</span> <span class='k'>height</span><span class='o'>,</span> <span class='k'>width</span><span class='p'>;</span>
  81. <span class='o'>-</span><span class='n'>moz</span><span class='o'>-</span><span class='n'>transition</span><span class='o'>-</span><span class='n'>property</span><span class='o'>:</span> <span class='k'>height</span><span class='o'>,</span> <span class='k'>width</span><span class='p'>;</span>
  82. <span class='n'>transition</span><span class='o'>-</span><span class='n'>property</span><span class='o'>:</span> <span class='k'>height</span><span class='o'>,</span> <span class='k'>width</span><span class='p'>;</span>
  83. <span class='p'>}</span>
  84. <span class='nc'>.isotope</span> <span class='nc'>.isotope-item</span> <span class='p'>{</span>
  85. <span class='o'>-</span><span class='n'>webkit</span><span class='o'>-</span><span class='n'>transition</span><span class='o'>-</span><span class='n'>property</span><span class='o'>:</span> <span class='o'>-</span><span class='n'>webkit</span><span class='o'>-</span><span class='n'>transform</span><span class='o'>,</span> <span class='k'>opacity</span><span class='p'>;</span>
  86. <span class='o'>-</span><span class='n'>moz</span><span class='o'>-</span><span class='n'>transition</span><span class='o'>-</span><span class='n'>property</span><span class='o'>:</span> <span class='o'>-</span><span class='n'>moz</span><span class='o'>-</span><span class='n'>transform</span><span class='o'>,</span> <span class='k'>opacity</span><span class='p'>;</span>
  87. <span class='n'>transition</span><span class='o'>-</span><span class='n'>property</span><span class='o'>:</span> <span class='n'>transform</span><span class='o'>,</span> <span class='k'>opacity</span><span class='p'>;</span>
  88. <span class='p'>}</span>
  89. </code></pre>
  90. </div>
  91. <h2 id='variations'>Variations</h2>
  92. <p>With these two options you can finely control how animation is handled across browsers.</p>
  93. <h3 id='best_available_recommended'>Best available (recommended)</h3>
  94. <p>Browsers that support CSS transitions will use them. Other browsers will fall back to using jQuery animation.</p>
  95. <ul>
  96. <li><strong>Add</strong> CSS transition declarations</li>
  97. </ul>
  98. <h3 id='always_use_jquery'>Always use jQuery</h3>
  99. <p>All browsers will use jQuery animation, regardless of their CSS transition support.</p>
  100. <ul>
  101. <li><code>animationEngine : &#39;jquery&#39;</code></li>
  102. <li><strong>No</strong> CSS transition declarations</li>
  103. </ul>
  104. <p>Never set <code>animationEngine : &#39;jquery&#39;</code> AND add CSS transition declarations. This will cause double-animation in browser that support CSS transitions &#8212; which is a bad thing.</p>
  105. <h3 id='only_css_transitions'>Only CSS transitions</h3>
  106. <ul>
  107. <li><code>animationEngine: &#39;css&#39;</code></li>
  108. <li><strong>Add</strong> CSS transition declarations</li>
  109. </ul>
  110. <h3 id='none'>None</h3>
  111. <p>Animation is not enabled in any browser</p>
  112. <ul>
  113. <li><code>animationEngine : &#39;css&#39;</code></li>
  114. <li><strong>No</strong> CSS transition declarations</li>
  115. </ul>
  116. <footer>
  117. Isotope by <a href="http://desandro.com">David DeSandro</a> / <a href="http://metafizzy.co">Metafizzy</a>
  118. </footer>
  119. </section> <!-- #content -->
  120. </body>
  121. </html>