Create a div with all of the properties.

Javascript No Comments »

function createDiv(obj){
            var gen = document.createElement("div");
                gen.id = obj.id;
                gen.style.top = obj.top + "px";
                gen.style.left = obj.left + "px";
                gen.style.width = obj.width + "px";
                gen.style.height = obj.height + "px";
                gen.style.position = "absolute";
                gen.style.pointerEvents = "none";
                if(obj.bkg) gen.style.background = obj.bkg;
                if(obj.parent) obj.parent.appendChild(gen);
            return gen;
        }

Slice X Amount from an Array

Javascript No Comments »

Send back chuncks from an array


var catImgs = ["1", "2", "3", "4", "", "6", "7", "8"];

var arr = newArray(catImgs,4);

function newArray(arr, count){
            var temp = [];
            var temp2 = [];
            var current = 0;
            for(var i = 0; i < arr.length; i++){
	      var obj = new Object
	      obj.id = i;
	      temp.push(obj);
	            
            }
            for(var j = 0; j < Math.ceil(temp.length / count); j++){
                temp2.push(temp.slice(current, current + count))
                current += count;
            }
            return temp2;
        }
visit my other website here >> noeone
Entries RSS Comments RSS Log in