.module {
float:left;
color: #fff;
}
.content_module {
background: teal;
width: 100%;
float: left;
}
.sidebar_module {
background: orange;
width: 100%;
float: right;
}
.postscript_module {
background: red;
width: 100%;
}
.sidecontent_module {
background: blue;
width: 100%;
}
/**
* Filter Styles
*
* Title, Parent and Child type styles globally are defined
* Filter groupd class used to define sets for mobile styles
*/
/* type */
.filter_title, h5.filter_title , .filter_title h5 {
display: inline-block;
font: bold 1em/1.923em AvSans, sans-serif;
letter-spacing: .075em;
padding-right: 0.385em;
}
.filter_parent {
font: 1em/1.923em AvSans, sans-serif;
text-transform: uppercase;
}
.filter_child {
font: 1em/1.154em AvSans, sans-serif;
padding: 0.385em 0;
}
.filter_child_horizontal {
display: inline-block;
font: 1em/1.154em AvSans, sans-serif;
padding: 0 .769em 0 0;
}
/* filter parent level menu */
.filter_menulist {margin: 0 -40px 1.585em; text-align: center;}
.filter_menulist li {display: inline;position: relative;}
.filter_menulist li:before {content: ":"; font-size: 1.1em; color: #00e295; font-weight: bold;}
.filter_menulist li:first-child:before {content: "";}
.filter_menulist a {padding: 0 0.692em 0 0.846em;}
.filter_menulist li:first-child a {padding: 0 .769em 0 0;}
/* vertical list for sidebars */
.filter_list, .filter_list a, .filter_list a:visited {display: block;}
.filter_list a:hover {color: #03c885; text-decoration: underline;}
.filter_list .filter_active {color: #03c885;}
/* Drop Down Filter Groups */
.filter_row {text-align: center; padding: 0.385em 0 1.538em;} /* padding for vertical alignment with heading */
.filter_row .filter_row_group {display: inline-block}
.filter_row .filter_row_group + .filter_row_group {margin-left: 2em}
/* Drop Down Filter Styles */
.filter_dropdown_group > li {margin-left: 0.769em}
.filter_dropdown_group > li:first-child {margin-left:...
JavaScript
$(function() {
// Find all DOM objects with a class of `.module` on the page
var $modules = $('[class^="module"]');
// Returns the type of class listed on the module
var getClassNames = function($module) {
var classList = $module.attr('class').split(/\s+/);
// We don't want the `.module` class, just the `._*module ones`
return classList[1];
};
// Create an object with all properties of the DOM modules (found in `$modules`)
var createModuleMap = function($modules) {
var moduleObj = {};
$.each($modules, function(i, val) {
/* Object which contains the following module properties:
* classSelector (DOM [object])
* className (class [string])
* pageWeight (number [int])
*/
var moduleNum = 'moduleNum_' + i;
var className = getClassNames($(val));
var data = {
classSelector: $(val),
className: className,
pageWeight: $(val).data('page-weight')
};
moduleObj[moduleNum] = data;
});
return moduleObj;
};
var moduleMap = createModuleMap($modules);
// Organize moduleMap obj. properties by pageWeight properties (in ascending order)
var sortModulesByMapWeight = function(moduleMap) {
var sortable = [];
for (var key in moduleMap) {
var obj = moduleMap[key];
for (prop in obj) {
// Only want to sort by this property
if (prop === 'pageWeight') {
// Sort by weights so we can move them in the `sortable` array which will allow us to sort them in sequential order
sortable.push([obj, obj[prop]]);
sortable.sort(function(a, b) {
return a[1] - b[1];
});
}
}
}
return sortable;
};
var makeSortedModuleObj =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.