Created
June 7, 2013 18:52
-
-
Save danielhaim1/5731513 to your computer and use it in GitHub Desktop.
If paragraph has data-pullquote="span", quote will pull the <span></span> from the paragraph and data-pullquote that span. the data-pullquote="attribute" can change to anything really, e.g. "strong", "em", "blockquote" etc.
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( $ ){ | |
var PULLQUOTE = 'data-pullquote'; | |
$('[' + PULLQUOTE + ']').each(function(){ | |
var $parent = $(this), | |
$quote = $parent.find( $parent.data('pullquote') ); | |
if ( $quote.length > 0 ) | |
{ | |
$parent | |
.attr( PULLQUOTE, $quote.eq(0).text() ) | |
.addClass( 'has-pullquote '); | |
} | |
}); | |
}( jQuery )); | |
/*** Example ***/ | |
/** | |
<p data-pullquote="span">Ut <span>et lacus in augue tristique mollis vitae at mi.</span> <br /> | |
Vestibulum eu tellus massa, sed rutrum eros. Nullam accumsan semper metus, vel tincidunt orci tincidunt quis.</p> | |
**/ | |
/* CSS Part */ | |
/*** | |
.has-pullquote::before { | |
padding: 0; | |
border: none; | |
content: attr(data-pullquote); | |
float: right; | |
width: 320px; | |
margin: 12px -140px 24px 36px; | |
position: relative; | |
top: 5px; | |
font-size: 23px; | |
line-height: 30px; | |
} | |
.pullquote-left::before { | |
float: left; | |
margin: 12px 31px 24px -102px; | |
width: 251px; | |
} | |
.pullquote-adelle:before { | |
font-family: Arial, sans-serif; | |
font-weight: 100; | |
top: 10px !important; | |
} | |
.pullquote-helvetica:before { | |
font-family: Arial, sans-serif; | |
font-weight: bold; | |
top: 7px !important; | |
} | |
.pullquote-facit:before { | |
font-family: Arial, sans-serif; | |
font-weight: bold; | |
top: 7px !important; | |
} | |
***/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment