enmi12/glossaire/_posts/docs/2010-12-01-introduction.mdown
changeset 0 d970ebf37754
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     1 ---
       
     2 
       
     3 title: Introduction
       
     4 category: docs
       
     5 layout: default
       
     6 toc:
       
     7   - { title: Features, anchor: features }
       
     8   - { title: Licensing, anchor: licensing }
       
     9   - { title: Getting started, anchor: getting_started }
       
    10   - { title: Code repository, anchor: code_repository }
       
    11   - { title: A word about moderation, anchor: moderation }
       
    12   - { title: Acknowledgments, anchor: acknowledgments }
       
    13   
       
    14 
       
    15 ---
       
    16 
       
    17 <p class="tagline">Isotope: An exquisite jQuery plugin for magical layouts</p>
       
    18 
       
    19 ## Features
       
    20 
       
    21 + [**Layout modes**](layout-modes.html): Intelligent, dynamic layouts that can't be achieved with CSS alone.
       
    22 + [**Filtering**](filtering.html): Hide and reveal item elements easily with jQuery selectors.
       
    23 + [**Sorting**](sorting.html): Re-order item elements with sorting. Sorting data can be extracted from just about anything.
       
    24 + **Interoperability**: features can be utilized together for a cohesive experience.
       
    25 + **Progressive enhancement**: Isotope's [animation engine](animating.html) takes advantage of the best browser features when available &mdash; CSS transitions and transforms, GPU acceleration &mdash; but will also fall back to JavaScript animation for lesser browsers.
       
    26 
       
    27 ## Licensing
       
    28 
       
    29 <p id="commercial">
       
    30   <strong>Commercial use of Isotope requires purchase of one-time license fee per developer seat.</strong> Commercial use includes any application that makes you money &mdash; portfolio sites, premium templates, etc. Commercial licenses may be purchased at <a href="http://metafizzy.co/#isotope-license">metafizzy.co</a>.
       
    31 </p>
       
    32 
       
    33 Use in non-commercial and personal applications is free.
       
    34 
       
    35 ## Getting started
       
    36 
       
    37 Isotope requires jQuery 1.4.3 and greater.
       
    38 
       
    39 ### Markup
       
    40 
       
    41 Isotope works on a container element with a group of similar child items.
       
    42 
       
    43 {% highlight html %}
       
    44 
       
    45 <div id="container">
       
    46   <div class="item">...</div>
       
    47   <div class="item">...</div>
       
    48   <div class="item">...</div>
       
    49   ...
       
    50 </div>
       
    51 
       
    52 {% endhighlight %}
       
    53 
       
    54 ### Script
       
    55 
       
    56 {% highlight javascript %}
       
    57 
       
    58 $('#container').isotope({
       
    59   // options
       
    60   itemSelector : '.item',
       
    61   layoutMode : 'fitRows'
       
    62 });
       
    63 
       
    64 {% endhighlight %}
       
    65 
       
    66 [**See Demo: Basic**](../demos/basic.html)
       
    67 
       
    68 There are a number of [options](options.html) you can specify.  Within the options is where you can [set the layout mode](layout-modes.html), [filter items](filtering.html),  and [sort items](sorting.html).
       
    69 
       
    70 Additionally you can specify a callback after the options object. This function will be triggered after the animation has completed.
       
    71 
       
    72 {% highlight javascript %}
       
    73 
       
    74 $('#container').isotope({ filter: '.my-selector' }, function( $items ) {
       
    75   var id = this.attr('id'),
       
    76       len = $items.length;
       
    77   console.log( 'Isotope has filtered for ' + len + ' items in #' + id );
       
    78 });
       
    79 
       
    80 {% endhighlight %}
       
    81 
       
    82 Within this callback <code><span class="k">this</span></code> refers to the container, and `$items` refers to the item elements. Both of these are jQuery objects and do _not_ need to be put in jQuery wrappers.
       
    83 
       
    84 ### CSS
       
    85 
       
    86 Add these styles to your CSS for [filtering](filtering.html), [animation](animating.html) with CSS transitions, and [adding items](adding-items.html).
       
    87 
       
    88 {% highlight css %}
       
    89 
       
    90 /**** Isotope Filtering ****/
       
    91 
       
    92 .isotope-item {
       
    93   z-index: 2;
       
    94 }
       
    95 
       
    96 .isotope-hidden.isotope-item {
       
    97   pointer-events: none;
       
    98   z-index: 1;
       
    99 }
       
   100 
       
   101 /**** Isotope CSS3 transitions ****/
       
   102 
       
   103 .isotope,
       
   104 .isotope .isotope-item {
       
   105   -webkit-transition-duration: 0.8s;
       
   106      -moz-transition-duration: 0.8s;
       
   107       -ms-transition-duration: 0.8s;
       
   108        -o-transition-duration: 0.8s;
       
   109           transition-duration: 0.8s;
       
   110 }
       
   111 
       
   112 .isotope {
       
   113   -webkit-transition-property: height, width;
       
   114      -moz-transition-property: height, width;
       
   115       -ms-transition-property: height, width;
       
   116        -o-transition-property: height, width;
       
   117           transition-property: height, width;
       
   118 }
       
   119 
       
   120 .isotope .isotope-item {
       
   121   -webkit-transition-property: -webkit-transform, opacity;
       
   122      -moz-transition-property:    -moz-transform, opacity;
       
   123       -ms-transition-property:     -ms-transform, opacity;
       
   124        -o-transition-property:      -o-transform, opacity;
       
   125           transition-property:         transform, opacity;
       
   126 }
       
   127 
       
   128 /**** disabling Isotope CSS3 transitions ****/
       
   129 
       
   130 .isotope.no-transition,
       
   131 .isotope.no-transition .isotope-item,
       
   132 .isotope .isotope-item.no-transition {
       
   133   -webkit-transition-duration: 0s;
       
   134      -moz-transition-duration: 0s;
       
   135       -ms-transition-duration: 0s;
       
   136        -o-transition-duration: 0s;
       
   137           transition-duration: 0s;
       
   138 }
       
   139 
       
   140 {% endhighlight %}
       
   141 
       
   142 ## Code repository
       
   143 
       
   144 This project lives on GitHub at [github.com/desandro/isotope](http://github.com/desandro/isotope). There you can grab the latest code and follow development.
       
   145 
       
   146 ## A word about moderation {: #moderation}
       
   147 
       
   148 Isotope enables a wealth of functionality. But just because you can take advantage of its numerous features together, doesn't mean you necessarily should. For each each feature you implement with Isotope, consider the benefit gained by users, at the cost of another level of complexity to your interface.
       
   149 
       
   150 ## Acknowledgments
       
   151 
       
   152 + [**"Cowboy" Ben Alman**](http://benalman.com/) for [jQuery BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (included with docs)
       
   153 + [**Louis-Rémi Babé**](http://twitter.com/Louis_Remi) for [jQuery smartresize](https://github.com/louisremi/jquery-smartresize) (used within Isotope) and for [jQuery transform](https://github.com/louisremi/jquery.transform.js) which clued me in to using jQuery 1.4.3's CSS hooks
       
   154 + [**Jacek Galanciak**](http://razorjack.net/) for [jQuery Quicksand](http://razorjack.net/quicksand/), an early kernel of inspiration
       
   155 + [**Ralph Holzmann**](http://twitter.com/#!/ralphholzmann) for re-writing the [jQuery Plugins/Authoring tutorial](http://docs.jquery.com/Plugins/Authoring) and opened my eyes to [Plugin Methods](http://docs.jquery.com/Plugins/Authoring#Plugin_Methods) pattern
       
   156 + [**Eric Hynds**](http://www.erichynds.com/) for his article [Using $.widget.bridge Outside of the Widget Factory](http://www.erichynds.com/jquery/using-jquery-ui-widget-factory-bridge/) which provided the architecture for Isotope
       
   157 + [**Paul Irish**](http://paul-irish.com) for [Infinite Scroll](http://infinite-scroll.com) (included with docs), the [imagesLoaded plugin](http://gist.github.com/268257) (included with Isotope), and  [Debounced resize() plugin](http://paulirish.com/demo/resize) (provided base for smartresize)
       
   158 + The [**jQuery UI Team**](http://jqueryui.com/about) for [$.widget.bridge](https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js#L113-155) (partially used within Isotope)
       
   159 + The Modernizr team for [Modernizr](http://www.modernizr.com/) (partially used within Isotope)
       
   160 + [**Juriy Zaytsev aka "kangax"**](http://perfectionkills.com) for [getStyleProperty](http://perfectionkills.com/feature-testing-css-properties/) (used within Isotope)
       
   161