Skip to content

Instantly share code, notes, and snippets.

@DaveVoyles
Created February 16, 2016 13:13
Show Gist options
  • Save DaveVoyles/940bbdae457260977b51 to your computer and use it in GitHub Desktop.
Save DaveVoyles/940bbdae457260977b51 to your computer and use it in GitHub Desktop.
evangelistTemplate
// Formats text for bio -- appears above each pin when selected
// Loops through content in "Locations" array and places it in bio
// RETURNS: A formatted string which is drawn to the screen
function formatBiography(name, city, spec, img, bio, twitter, websiteUrl) {
var html = [""];
// Loop through all args; if any are not defined, just set them to an empty string
for (var i = 0; i < arguments.length; i++) {
if (arguments[i] == null) {
arguments[i] = "";
}
}
html.push(
'<div class="bio-container">' +
'<h1 id="firstHeading" class="firstHeading">' + name + '</h1>' +
'<h3>' + city + '</h3>' +
'<h3>' + spec + '</h3>' +
'<div id="bodyContent">' +
bio +
'</div> <!-- .bodyContent-->' +
'<p>' +
'<a href=' + twitter + '/>' + twitter +
'<p>' +
'<a href="' + websiteUrl + '"/>' + websiteUrl +
'</div> <!-- Bio Container -->' +
'<img src=' + img + ' class = "evangelist-img">' +
'</div><!-- .bio-container -->'
);
return html.join('');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment