public
Description: script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
Home | Edit | New

Sortable.sequence

<link rel=“stylesheet” title=“Sunburst” href=“http://script.aculo.us/github/styles/sunburst.css”/

Behaviours > Sortable > sequence

The Sortable object also provides a function to get a sequence array of the id’s.

Syntax


id_array = Sortable.sequence('id_of_container');

Example

Taken from the Puzzle Demo


(function() { 
  var p = $('puzzle'), info = $('puzzleinfo'), moves = 0;

  Sortable.create('puzzle', {
    tag: 'img', overlap: 'horizontal', constraint: false,
    onUpdate: function() {
      info.update('You\'ve made ' + (++moves) + ' move' + (moves > 1 ? 's' : ''));
      if (Sortable.sequence('puzzle').join('') == '123456789')
         info.update('You\'ve solved the puzzle in ' + moves + ' moves!').morph('congrats');
    }
  });
})();
Last edited by macinjosh, Tue May 12 12:46:33 -0700 2009
Home | Edit | New
Versions: