Writing for Readability
by cliftonyeo
CSS
.work {
background: orange;
width: 100px;
height: 200px;
}
.work p:first-child {
font-weight: bold;
}
JavaScript
var work = {
title: "my work",
description: "this is a description"
}
function getWork() {
return work;
}
function getTitle() {
return getWork().title;
}
function getDesc() {
return getWork().description;
}
function getNewElement() {
var newDiv = $('<div></div>');
return newDiv;
}
function showWork(workToShow) {
console.log(workToShow);
workToShow.appendTo("body");
}
function loadWork() {
var artwork = getNewElement();
artwork.html(
"<p>" + getTitle() + "</p>" +
"<p>" + getDesc() + "</p>"
);
applyStyles(artwork);
showWork(artwork);
}
function applyStyles(elem) {
elem.addClass('work');
//elem.css('width', 100); //adjust one at a time
}
loadWork();