Skip to content

Instantly share code, notes, and snippets.

@orellabac
Created September 17, 2015 04:19
Show Gist options
  • Save orellabac/e03e3c61b2d3cc7cbadc to your computer and use it in GitHub Desktop.
Save orellabac/e03e3c61b2d3cc7cbadc to your computer and use it in GitHub Desktop.
function cascadeArrange(windows)
{
var i = 0;
var maxHeight = 0;
var currentX = 50;
var currentY = 50;
var maxWidth = window.innerWidth;
var padding = 50;
var paddingY = 30;
for (i=0;i<windows.length;i++)
{
var currentWindow = $(windows[i]);
var height = Number.parseInt( currentWindow.css("height"));
var width = Number.parseInt( currentWindow.css("width"));
currentWindow.css("left",currentX + "px");
currentWindow.css("top",currentY +"px");
currentY += paddingY;
currentX += padding;
}
}
cascadeArrange($(".k-window").sort(function(a,b) { return Number.parseInt($(a).css("z-index")) > Number.parseInt($(b).css("z-index")); }))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment