Friday, April 6, 2012

Rearranging Images in

In one of my current projects, we require an image gallery that is basically sortable. The gallery we settled on, which is actually quite powerful, was Eventually,we ended up with a left and right arrow button under the gallery, which will modify the underlying data. After modifying the data we called .load() on the galleria gallery.

One problem - the gallery would load the new order of images, and then switch to the first image. Easy enough fix - we could just immediately call .show(). Unfortunately this created the problem of "jumping" images - .load would still start on the first image, and then quickly fly over to the current image, every time we reordered.

This seems to be a limitation of - loading does not allow us to specify a default start image. Our eventual fix. Unfortunately, was a two line change to

load : function( source, selector, config, index) {

  // Modified by AIS to allow index to be set at load time
  if (index !== undefined) = index;

We added a new param, index, to the load function, and set the start image as the index. Not pretty, but it worked. Anyone have a better idea?

No comments :

Post a Comment