Created
November 13, 2013 18:43
-
-
Save adamwulf/7454134 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
// the height of the content, discluding the header/footer | |
var content_height = 652; | |
// the beginning page number to show in the footer | |
var page = 1; | |
var hasAddedBios = false; | |
function buildNewsletter(){ | |
if($('#newsletterContent').contents().length > 0){ | |
// when we need to add a new page, use a jq object for a template | |
// or use a long HTML string, whatever your preference | |
$page = $("#page_template").clone().addClass("page").css("display", "block"); | |
// append the page number to the footer | |
$page.find(".footer span").append(page); | |
$("body").append($page); | |
page++; | |
// here is the columnizer magic | |
$('#newsletterContent').columnize({ | |
columns: 2, | |
target: ".page:last .content", | |
overflow: { | |
height: content_height, | |
id: "#newsletterContent", | |
doneFunc: function(){ | |
console.log("done with page"); | |
buildNewsletter(); | |
} | |
} | |
}); | |
}else if(!hasAddedBios){ | |
// this will add a new page, that is columnized just | |
// like the rest of the document, but only contains | |
// the content of #bios in the first column. | |
hasAddedBios = true; | |
$('#newsletterContent').append($('#bios')); | |
buildNewsletter(); | |
} | |
} | |
buildNewsletter(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment