jQuery Instagram plugin redesign

The plugin uses the Instagram API to get a list of photos using the JSONP format, the original idea is by Daniel Pavitt.

Up to version 0.2 you could just make a call to

1
2
3
4
$('.selector').instagram({
  hash: 'boat',
  clientId: 'YOUR-CLIENT-ID'
});

to populate .selector element with a list of <div> elements containing photos from Instagram.

You couldn’t modify the generated code except by using the onComplete callback, see issue #33.

Since version 0.3 I removed code generation and callbacks. Now code generation is up to the user and willLoadInstagram and didLoadInstagram events are triggered instead of using callbacks.

The didLoadInstagram event is triggered when Instagram API responds, the associated handler can access the whole response. Example:

1
2
3
4
5
6
7
8
$('.selector').on('didLoadInstagram', function(event, response) {
  console.log(response);
});

$('.selector').instagram({
  hash: 'boat',
  clientId: 'YOUR-CLIENT-ID'
});

You can find more examples at http://potomak.github.io/jquery-instagram/.

Moreover the plugin has been generated using grunt-init, it uses grunt as build system, and it includes tests made using the QUnit framework.

You can fork the project at http://github.com/potomak/jquery-instagram.

Next: Ludum Dare Post Mortem