Team:Vanderbilt/subpagebuilder
From 2014.igem.org
(Difference between revisions)
(3 intermediate revisions not shown) | |||
Line 43: | Line 43: | ||
img.width = w; | img.width = w; | ||
img.height = h; | img.height = h; | ||
- | img.style.margin = "0px"; | + | img.style.margin = "0px"; |
+ | |||
+ | var text = document.createElement("p"); | ||
+ | text.appendChild(document.createTextNode(para)); | ||
+ | text.style.height = "30px"; | ||
+ | text.style.textAlign = "right"; | ||
+ | text.style.overflow = "auto"; | ||
+ | text.style.fontStyle = "italic"; | ||
+ | text.style.margin = "2px"; | ||
var photo = document.createElement("div"); | var photo = document.createElement("div"); | ||
Line 50: | Line 58: | ||
photo.style.display = "inline-block"; | photo.style.display = "inline-block"; | ||
photo.style.width = img.width + "px"; | photo.style.width = img.width + "px"; | ||
- | photo.style.height = " | + | photo.style.height = img.height + text.style.height + "px"; |
photo.style.padding = "0.5em"; | photo.style.padding = "0.5em"; | ||
photo.style.margin = "1%"; | photo.style.margin = "1%"; | ||
photo.style.boxShadow = "0 0 3px rgba(0,0,0,0.3)"; | photo.style.boxShadow = "0 0 3px rgba(0,0,0,0.3)"; | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
photo.appendChild(img); | photo.appendChild(img); |
Latest revision as of 23:25, 25 January 2015
var leftPageBuilder = document.getElementById("left_page"); var rightPageBuilder = document.getElementById("right_page");
function SubPageBuilder() {
var maxSubPage = 1;
this.getMaxSubPage = function() { return maxSubPage; };
this.createSubPage = function (subPageNum) {};
this.addMultLI = function(ul, arr) { for(var i = 0; i < arr.length; i++) { var tmp = document.createElement("LI"); tmp.appendChild(document.createTextNode(arr[i])); ul.appendChild(tmp); } };
this.insertTextRow = function(table, names){ var row = table.insertRow(); row.style.textAlign="center"; for (var i = 0; i < names.length; i++) { var str = row.insertCell(i); str.innerHTML = names[i]; } };
this.createRowFromArray = function(table, elements) { var row = table.insertRow(); row.style.textAlign="center"; for (var i = 0; i < elements.length; i++) { var str = row.insertCell(i); str.appendChild(elements[i]); } };
this.createPhoto = function(src, alt, w, h, para) { var img = document.createElement("img"); img.src = src; img.alt = alt; img.width = w; img.height = h; img.style.margin = "0px";
var text = document.createElement("p"); text.appendChild(document.createTextNode(para)); text.style.height = "30px"; text.style.textAlign = "right"; text.style.overflow = "auto"; text.style.fontStyle = "italic"; text.style.margin = "2px";
var photo = document.createElement("div"); photo.style.backgroundColor = "floralwhite"; photo.style.position = "relative"; photo.style.display = "inline-block"; photo.style.width = img.width + "px"; photo.style.height = img.height + text.style.height + "px"; photo.style.padding = "0.5em"; photo.style.margin = "1%"; photo.style.boxShadow = "0 0 3px rgba(0,0,0,0.3)";
photo.appendChild(img); photo.appendChild(text); return photo; };
this.createP = function(str){ var p = document.createElement("p"); p.appendChild(document.createTextNode(str)); return p; };
this.createPlainIMG = function(src, alt, w, h){ var img = document.createElement("img"); img.src = src; img.alt = alt; img.width = w; img.height = h; return img; };
this.createIMG = function(src, alt, w, h, f){ var img = document.createElement("img"); img.src = src; img.alt = alt; img.width = w; img.height = h; img.className = "var_page_img"; img.style.float = f; img.style.marginLeft = "1%"; img.style.marginRight = "1%";
return img; };
}