Isotope v1.5 - Hollaback now y'all

20 Oct 2011 · by David DeSandro

Proper callbacks that trigger after animations has been one of oldest lingering issues with Isotope since its release. But fret no more! With yesterday's release of version 1.5, Isotope can callback all over the dance floor. Check out the sweet callback action on this test page.

Like most issue resolutions, I had punted this one for a while because I knew that getting it to work would take a lot of code. I was right. You might think "jQuery has callback integration in just about everything. How hard can it be?" The problem is not so much with jQuery, as it is with triggering a callback with CSS transitions in place. Here's a walkthrough of the logic that had to be put into place just for CSS transition callbacks.

  • Get transition-end event name for browser, i.e. WebkitTransitionEnd. lines 255-261
  • Get transition-duration style property name for browser, i.e. -webkit-transition-duration line 262
  • For the group of elements that will be transitioned, check if one of them actually has a transition duration value greater than 0. lines 652-668
  • If so, bind a callback to that transition-end event for all these elements. line 262
  • Make sure that callback only triggers once. line 637

Even after all of this there is plenty of use cases that will break a callback from triggering with CSS transitions. But hopefully, for the majority of users, their callbacks will trigger right after the animation or transition completes and no one will be the wiser. If you do run into problems with this new feature, help a guy out and submit an issue.

Support service not available

11 Oct 2011 · by David DeSandro

Yay, I'm getting married in a month! Between getting all the final details together, going on a honeymoon, and my full time job, I have no bandwidth to take on any support requests. So I'm taking off support service until December 2011. I apologize for the lapse in service and wish you the best of luck debugging your way out of the trenches.

Have a spooky Halloween and scrumptious Thanksgiving!

Every story has a beginning by Tim Sherratt

7 Oct 2011 · by David DeSandro

It's a delight to discover new sites that use Isotope. I get a big kick out of seeing what content was used, and how the site takes advantage of Isotope's multiple features. But every so often, someone manipulates the plugin to their own devices, leaving behind established conventions, and makes something unique. Every story has a beginning by Tim Sherratt is one such site. It is the visual presentation delivered by Sherratt at the conference of the Australia and New Zealand Society of Indexers, on September 14, 2011.

Every story has a beginning by Tim Sherratt

Most Isotope implementations have a big set of items, and then from that set, you can filter and sort them. This presentation works the other way. Beginning from a blank canvas, items are iteratively added, to coincide with each talking point. Isotope then takes that new item and shuffles the others around it. In addition, the final talking points trigger filters that group similar items together. It feels like you're watching the ideas aggregate then coalesce at the conclusion.

Pete Johnston elaborates:

I enjoyed the form of the presentation itself. The content is built up incrementally on the screen, with an engaging element of "dynamism" but kept simple enough to avoid the sort of vertiginous barrage that seems to characterise the few Prezi presentations I've witnessed. And perhaps most important of all, the presentation itself is very much "a thing of the Web": many of the images are hyperlinked through to the "live" resources pictured, providing not only a record of "provenance" for the examples, but a direct gateway into the data sources themselves, allowing people to explore the broader context of those individual records or fragments or visualisations.

It's a joy to discover a creation your own work used in a way surprises you, to discover that someone else can make it all their own. Sherratt even proclaims Death to Powerpoint. Hell yes.

Right-to-left layouts for Isotope

19 Aug 2011 · by David DeSandro

Developers for Hebrew and Arabic sites can now use Isotope for right-to-left layouts. Take a look at the right to left test. To make it happen, you'll need to make a couple simple modifications explained in Help - Right-to-left layouts. This feature is made possible by relying on right/top position styles. This consequently disables CSS transform positioning, which comes with the trade-off of sacrificing hardware-acceleration.

One set of docs to rule them all

12 Aug 2011 · by David DeSandro

Managing documentation can easily grow to be an overwhelming and tedious undertaking for any developer who open sources her code. Consider how many places docs, demos, and instructions can appear for one project:

  • README
  • within the project source itself
  • GitHub wiki
  • developer's personal site
  • external site just for project
  • project listing page - like plugins.jquery.com

With Masonry v1, my docs had sprawled out to several different locations. To properly update a page, I had to update it in three places: the documentation site, the file in the downloadable project and on another home page. This was a pain as each piece was managed separately: upload via FTP, change a CMS, push via Git. It made me anxious to change anything, lest I tear apart the web of documentation across the various sources.

One of my bigger over-arching goals releasing Isotope was to streamline the documentation. It was a matter of laziness. I just didn't want to bother maintaining multiple sources for related information about my project. Ideally, I wanted to be able to update one source, and have those changes reflected in the various distribution channels -- in both the external project and the downloadable zip of the project.

Documentation site

My approach now is build the documentation and demos into the project itself, keeping everything in the same place. The project is the doc site is the downloadable zip. This is made possible with GitHub Pages, which generates a live site from a git repo. All you need to do is add content to a new branch gh-pages, and GitHub takes care of the rest for you.

For my purposes, my two branches gh-pages and master are pretty much identical. gh-pages has a couple extra bits just for the live site, like a favicon, 404 page, and analytics scripts. Whenever I make a commit to master, I merge it into gh-pages and push up both the commits to GitHub.

# master branch checked out
git commit
git checkout gh-pages
git merge master
git push

Here's what the commit tree looks like for Masonry.

Git commits for Masonry

Note the commit at the bottom of pic, docs : change analytics back to mint which is commited to gh-pages, but not master.

Jekyll

GitHub Pages comes built with Jekyll, a static-site generator. This is the awesome. Typically, Jekyll is labeled as a blogging framework, but it has several key features that I have merrily put to use for my docs.

Leveraging templates and includes keeps the code across pages consistent and helps you separate proper content from repetitive scaffolding that can bloat your project's source. Masonry's docs use just one page template. The navigation for every page is dynamically generated.

The Markdown parser allows documentation content to be written in a plain-text format and get generated with proper markup. On top of this, Maruku generates anchor id attributes for header tags, which can be used for in-page linking, i.e. isotope.metafizzy.co/docs/options.html#filter.

With Liquid templating and the ability to add metadata via YAML front matter or config.yml, you can iterate through data points and generate long lists of content, without having to explicitly code each one. I found this especially useful for generating the element items in the Isotope demos. All the data for each element can be found in config.yml. This large array is then iterated through in the page content, with each item's markup being produced with a partial include.

Pygments take care of syntax highlighting on the server-side. See Liquid Extensions > Code Highlighting at bottom.

Downloadable zip

The drawback to relying on a templating engine to generate pages is that the source code is not readily viewable for anyone checking out the project or downloading it. The GitHub project Downloads button is pretty much useless for Isotope and Masonry.

I still want to provide a downloadable zip of the project that anyone can open up, start exploring, and tinker around with. My solution was to zip up the Jekyll generated content and host it on my site. I've whittled this task down into a bash script:

function zipup() {
  mkdir $1
  # copies Jekyll generated _site
  cp -r _site/ $1
  # zips it up
  zip -r -q $1.zip $1/
  rm -rf $1
  echo "transferring $ZIPFILE to path/to/dir"
  # transfers site.zip to server
  scp $1.zip user@example.com:path/to/dir
  rm $1.zip
}

# in use
zipup isotope-site

This script generates the zip files you'll find in meta.metafizzy.co/files.

Workflow

Even though the zip doesn't exactly fit in with GitHub pages, this entire setup allows me to make changes to a project, live site, and downloadable file, all without fussing with FTP, a CMS, or server files.

  • Make changes
  • View changes locally by running Jekyll
  • Commit changes to master branch
  • Merge commit to gh-pages branch
  • git push commits to remote, pushes changes to live site
  • run zipup script, updates downloadable zip

I realize that "buying into" GitHub Pages comes with its tradeoffs. There's no support for .htaccess files, which means that re-directs are nigh-impossible. Post files need to have a date in their filename. But on the whole, I would recommend this approach for anyone who has their project on GitHub and needs to care of the docs.

All these features help alleviate the tedious nature of writing and maintaining documentation. Instead of producing brief overviews, I feel compelled to write detailed explanations, and to create as many demos as need be. It may seem like an over-abundance of information that might turn off new users. But as support requests come in, it's a great feeling to provide a link to the docs, mentally declaring RTFM, and being done with it.

Motion/Emotion

4 Aug 2011 · by David DeSandro

A couple weeks ago, I spoke at Aol HQ about animation in web design. I took the opportunity to discuss some of the inner logic within Isotope, and how you can use it in your own applications. You can view the presentation outline, which has demos and code examples throughout: desandro.github.com/motion-emotion/. Inside you'll also find the technique I use on this site for the transitioning link color.

My thanks to Nate Eagle and Dave Artz for the invitation, and for the sweet hoodie that I wear this moment as I write this post.