From a23c18e5528fdbc57b118b78414c4dea3cb69be8 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Sat, 15 Oct 2011 12:43:25 -0400 Subject: [PATCH] docs : filtering : initialize isotope before filter helps with #98 --- _posts/docs/2010-12-06-filtering.mdown | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/_posts/docs/2010-12-06-filtering.mdown b/_posts/docs/2010-12-06-filtering.mdown index 1e64593..bb14ba9 100644 --- a/_posts/docs/2010-12-06-filtering.mdown +++ b/_posts/docs/2010-12-06-filtering.mdown @@ -71,9 +71,17 @@ Here we set the filter for each link with a `data-filter` attribute. In our jQue {% highlight javascript %} +// cache container +var $container = $('#container'); +// initialize isotope +$container.isotope({ + // options... +}); + +// filter items when filter link is clicked $('#filters a').click(function(){ var selector = $(this).attr('data-filter'); - $('#container').isotope({ filter: selector }); + $container.isotope({ filter: selector }); return false; });