MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 88: | Line 88: | ||
} ); | } ); | ||
}); | |||
// Long list into col | |||
$( document ).ready( function(){ | |||
var longList = $("#longList").addClass("row"), | |||
dlElements = longList.children().filter("dl"), | |||
dlElementsLength = dlElements.length; | |||
var list1 = [], | |||
list2 = []; | |||
var count = 0; | |||
dlElements.each( function(index, ele){ | |||
if( count < dlElementsLength/2 ){ | |||
list1.push(ele); | |||
list1.push( $(ele).next() ); | |||
} else { | |||
list2.push(ele); | |||
list2.push( $(ele).next() ); | |||
} | |||
count = count + 1; | |||
}); | |||
longList.empty(); | |||
var leftDiv = $("<div/>").addClass("col"); | |||
list1.forEach( function(value, index){ | |||
leftDiv.append(value); | |||
}); | |||
var rightDiv = $("<div/>").addClass("col"); | |||
list2.forEach( function(value, index){ | |||
rightDiv.append(value); | |||
}); | |||
longList.append(leftDiv, rightDiv ); | |||
}); | }); |