-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjquery.transpose.min.js
More file actions
10 lines (10 loc) · 905 Bytes
/
jquery.transpose.min.js
File metadata and controls
10 lines (10 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
/*
* jQuery transpose() plugin
*
* Version 1.2 (2 Aug 2011)
*
* Copyright (c) 2011 Robert Koritnik
* Licensed under the terms of the MIT license
* http://www.opensource.org/licenses/mit-license.php
*/
(function(b){var a={containerKey:"transposed",itemKey:"pre-transpose-index"};b.fn.extend({transpose:function(){if(this.length>2){var c=this;var d=this.parent();d.each(function(){var h=this;var g=b(this);if(typeof(g.data(a.containerKey))=="undefined"){g.data(a.containerKey,true);var m=c.filter(function(){return this.parentNode==h});var e=m.length;var l;if(e>2){var o;var f=m.eq(0).position().top;for(o=1;o<e&&f==m.eq(o).position().top;o++){}var p=parseInt(e/o)+1;if(e>o&&o>1){var n=[];for(var j=0;j<o;j++){n.push(p-(j%o<e%o?0:1))}l=b();var k=0;for(var j=0;j<e;j++){l=l.add(m.eq(k).detach().data(a.itemKey,k));k+=n[j%o];if(k>=e){k++}k=k%e}l.appendTo(g).after("\n")}}}})}return this}})})(jQuery);