/* Copyright 2014 Michael Dibbets, all rights reserved.
This library is free to use for non commercial use, if you leave a comment below this blog post
where you are implementing this libary.
For commercial use contact me to come to an licensing agreement.
mdibbets [at] outlook [dot] com
My prices are fair and reasonable.
ususage of this script without notification of the author
in the before mentioned ways is not permitted.
*/
function JX_responsive_sort(precursor)
{
if(typeof precursor == 'undefined')
{
precursor = 'conditional';
}
// our sorting array
var orderofthings = new Array();
// window width
var windowwidth = $(window).innerWidth();
// get all classes named conditional
jQuery('.'+precursor).each(function()
{
// get all classes of the conditional element
var classList = jQuery(this).attr('class').split(/\s+/);
// loop through all classes of the current element
// backwards compatible... of course
for(c=0;c<classList.length;c++)
{
item=classList[c];
// no need for this one bub
if(item != precursor)
{
if(item.substring(0,11) == precursor)
{
// sanitise the item
item = item.substring(12,item.length);
// from which screenwidth is this rule active?
var startwidth = parseInt(item.substring(0,item.indexOf('_')));
// to which screenwidth is this rule active?
var endwidth = parseInt(item.substring(item.indexOf('_')+1,item.indexOf('_',item.indexOf('_')+1)));
if(windowwidth >= startwidth && windowwidth <= endwidth)
{
// remove the widths so all that remains are commands
item = item.substring(item.indexOf('_',item.indexOf('_')+1)+1,item.length);
...
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.