briankoser / kotangent-jekyll

Kotangent, the Weblog of Brian Koser
MIT License
1 stars 0 forks source link

Pull quotes #45

Open briankoser opened 10 years ago

briankoser commented 10 years ago

Implement pull quotes for articles

<style>
.pullquote {
    border: solid 1px grey;
    border-left: none;
    border-right: none;
    color: grey;

    font-size: 1.4em;
    /* font, line-height, etc. */
    float: right;
    position: relative; top: 5px;
    margin: 5px 15px 5px 0;
    max-width: 15em; /* or width?*/
    padding: 10px 5px;
}
</style>
<script>
    document.addEventListener('DOMContentLoaded', addPullQuote);

    function addPullQuote() {
        var original = document.querySelectorAll('.pullquote-original')[0]; // limit to one pull quote per page
        var originalparagraph = original.parentNode;
        <!-- set parent to position relative? -->
        var pullquote = document.createElement('aside');
        pullquote.setAttribute('class', 'pullquote');
        pullquote.innerHTML = original.innerHTML;
        originalparagraph.parentNode.insertBefore(pullquote, originalparagraph); // instead, insert before second paragraph?
    }
</script>