enmi12/glossaire/_posts/docs/2011-12-11-help.mdown
author ymh <ymh.work@gmail.com>
Mon, 14 Oct 2019 17:39:30 +0200
changeset 7 cf61fcea0001
parent 0 d970ebf37754
permissions -rwxr-xr-x
resynchronize code repo with production
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
---
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
title: Help
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
category: docs
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
layout: default
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
toc:
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
  - { title: Reporting bugs and issues, anchor: reporting_bugs_and_issues }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
  - { title: Additional resources, anchor: additional_resources }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
  - { title: Unloaded media, anchor: unloaded_media }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
  - { title: Images, anchor: images }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
  - { title: @font-face fonts, anchor: fontface_fonts }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
  - { title: Problems with CSS transforms, anchor: css-transforms }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
  - { title: Getting item position, anchor: getting_item_position }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
  - { title: Accessing the instance, anchor: accessing_the_instance }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
  - { title: CSS transforms in Opera, anchor: css_transforms_in_opera }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
  - { title: Infinite Scroll with filtering or sorting, anchor: infinite_scroll_with_filtering_or_sorting}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
  - { title: Poor type rendering in WebKit, anchor: poor_type_rendering_in_webkit }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
  - { title: First item breaks Masonry layout, anchor: first_item_breaks_masonry_layout }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
  - { title: Right-to-left layouts, anchor: righttoleft_layouts }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
  - { title: Preventing clicks on filtered items, anchor: unclickable-filtered }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
---
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
## Reporting bugs and issues
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
Please read my [Issues Agreement](https://github.com/desandro/issues-agreement/#readme) and then [report bugs and issues on GitHub](http://github.com/desandro/isotope/issues). 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
## Additional resources
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
+ The [Metafizzy blog](http://metafizzy.co/blog/) has posts that cover specialized use cases
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
+ [Various Isotope tests on jsFiddle](http://www.delicious.com/desandro/re:isotope+fiddle)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
+ [My answers on Stack Overflow](http://stackoverflow.com/users/182183/desandro?tab=answers)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
+ [Sites using Isotope on Zootool](http://zootool.com/user/desandro/tag:isotope), has screenshots
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
+ [Sites using Isotope on Delicious](http://www.delicious.com/desandro/using:isotope)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
+ [Miscelleanous Isotope content](http://www.delicious.com/desandro/re:isotope)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
## Unloaded media
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
Most layout modes (i.e masonry, fitRows) need to measure the size of each item to appropriately account for its space in the layout. Unloaded media files like images and @font-face fonts can throw off layout and cause item elements to overlap one another. Ideally, Isotope layouts should be initialized after all inner content has loaded.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
## Images
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
### Inline dimensions
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
For images, the best method is to specify the width and height of images inline.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
{% highlight html %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
<img src="img-file.jpg" width="280" height="160" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
{% endhighlight %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
If you’re using a PHP-based CMS, you can use the [getimagesize](http://php.net/manual/en/function.getimagesize.php) function.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
### imagesLoaded plugin
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
The next best solution is to use the [imagesLoaded plugin](https://github.com/desandro/imagesloaded) included with Isotope. It's a small plugin that finds all the images in a context, and fires a callback function once all the images have loaded.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
{% highlight javascript %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
var $container = $('#container');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
$container.imagesLoaded( function(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
  $container.isotope({
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
    // options...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
  });
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
{% endhighlight %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
### `$(window).load()`
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
Another solution is to initialize Isotope inside `$(window).load()` instead of `$(document).ready()`. This will trigger Isotope after all the media on the page has loaded.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
{% highlight javascript %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
$(window).load(function(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
  $('#container').isotope({
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
    // options...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
  });
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
{% endhighlight %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
## @font-face fonts
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
Both Typekit and Google WebFont Loader provide font events to control scripts based on how fonts are loaded. 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
+ [Typekit font events](http://blog.typekit.com/2010/10/18/more-control-with-typekits-font-events/)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
+ [Google WebFont Loader: Events](http://code.google.com/apis/webfonts/docs/webfont_loader.html#Events)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
## Problems with CSS transforms {: #css-transforms}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
As the browser implementations of CSS tranforms are still a work-in-progress, they can cause buggy behavoir with other types of dynamic content.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
<div id="flash"></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
+ [Flash content in Safari and Firefox](http://dropshado.ws/post/4085720152/css-transforms-breaking-flash), like YouTube or Vimeo videos, Flash ads, or Flash audio players.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
### Disabling transforms
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
Set [`transformsEnabled`](options.html#transformsenabled) to `false`. This is an easy step to take when troubleshooting.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
{% highlight javascript %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
$('#container').isotope({
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
  // options...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
  transformsEnabled: false
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
{% endhighlight %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
## Getting item position
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
CSS transforms will break previous patterns for getting the position of an item. See the [`itemPositionDataEnabled`](options.html#itempositiondataenabled) option for a stop-gap.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
## Accessing the instance
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
[Similar to jQuery UI](http://docs.jquery.com/UI_Developer_Guide#Internal_functions_.26_scopes_explained), Isotope stores a instance containing properties, settings and methods with jQuery.data. You can access the instance with the `'isotope'` namespace.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
{% highlight javascript %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
var $container = $('#container');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
// initialize Isotope instance
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
$container.isotope({
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
  // options...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
// get Isotope instance
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
var isotopeInstance = $container.data('isotope');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
isotopeInstance.options; // options
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
isotopeInstance.$filteredAtoms; // jQuery object of filtered & sorted item elements
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
isotopeInstance.masonry.columnWidth; // Layout mode specific properties
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
{% endhighlight %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
## CSS transforms in Opera
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
[Using CSS transforms in older versions Opera (< 12) distorts text rendering](http://dropshado.ws/post/1260101028/opera-transform-issues). See how to enable [CSS transitions with top, left positioning](options.html#transformsEnabled-css).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
## Infinite Scroll with filtering or sorting
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
I recommend against using Infinite Scroll with filtering or sorting. This combination produces a unnecessarily complex user interaction that will frustrate your users. New content gets added, but part of it might be hidden. There is no way for the user to tell what gets hidden or re-arranged when Infinite Scroll adds more content. Exercise [moderation](introduction.html#moderation) with your Isotope implementation.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
If you do plan on implementing Infinite Scroll with filtering or sorting (which is a _bad idea_), use the `insert` method instead of `appended`.  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
## Poor type rendering in WebKit
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
Type rendering may appear poor in WebKit browsers like Chrome and Safari. This is because of Isotope's activation of hardware acceleration. A solution is to add add a matching background to the item elements. See more: [dropshado.ws - Resolving anti-aliasing on WebKit hardware-accelerated elements](http://dropshado.ws/post/6142339613/resolving-anti-aliasing-on-webkit-hardware-accelerated).  Another solution is to [disable transforms](#disabling_transforms).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
## First item breaks Masonry layout
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
With [Masonry layout mode](layout-modes.html#masonry) If you run into an issue where you re-size the first item, and all the rest of the items no longer fit together in the grid, you most likely need to set [`columnWidth` option](layout-modes.html#masonry-options). Without `columnWidth` set, the Masonry layout mode will use the width of the first item for the size of its columns.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
{% highlight javascript %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
$('#container').isotope(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
  masonry: {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
    columnWidth: 220
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
  }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
{% endhighlight %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
## Right-to-left layouts
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
Isotope can be modified to support right-to-left layouts for languages like Hebrew and Arabic.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
[**See test: Right to left**](../tests/right-to-left.html)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
You'll need to make the following changes:
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
+ Modify Isotope's `_positionAbs` method
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
+ Set `transformsEnabled: false` in the Isotope options
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
+ Add CSS transition property styles for right/top.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
### JavaScript for right-to-left support
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
{% highlight javascript %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
// modify Isotope's absolute position method
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
$.Isotope.prototype._positionAbs = function( x, y ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
  return { right: x, top: y };
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
};
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
// initialize Isotope
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
$('#container').isotope({
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
  transformsEnabled: false
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
  // other options...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
{% endhighlight %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
### CSS for right-to-left support
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
{% highlight css %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
.isotope .isotope-item {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
  -webkit-transition-property: right, top, -webkit-transform, opacity;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
     -moz-transition-property: right, top, -moz-transform, opacity;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
      -ms-transition-property: right, top, -ms-transform, opacity;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
       -o-transition-property: right, top, -o-transform, opacity;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
          transition-property: right, top, transform, opacity;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
{% endhighlight %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
## Preventing clicks on filtered items {: #unclickable-filtered}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
The [recommended CSS for filtering](filtering.html#recommended_css) includes `pointer-events: none` for `.isotope-hidden`. Unfortunately, Opera and Internet Explorer still let click events propagate with this style in place. But you can still dismiss click events in your click handler by checking to see if the element or element's parent is a filtered item.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
[See test: Unclickable filtered](../tests/unclickable-filtered.html)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
{% highlight javascript %}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
$('.item a').click(function(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
  var $this = $(this);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
  // back out if hidden item
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
  if ( $this.parents('.isotope-item').hasClass('isotope-hidden') ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
    return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
  }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
  // otherwise, continue to do stuff...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
  console.log('item was clicked');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
{% endhighlight %}