Web development , php , ajax , symfony, framework, zend
In: web resources
23 Nov 2009Chris Coyier authored a post titled Better Pull Quotes: Don’t Repeat Markup a while back. In his post he created great-looking pull quotes without repeating any content — instead he uses jQuery to dynamically create the pull quotes. The following is the MooTools method for doing so.
<p><span class="pull-me">As a MooTools "insider", however, I'm excited for what the MooTools team will bring to the table during 2010.</span> We'll be launching the Forge (our public plugin repository), releasing MooTools 2, continuing to grow MooTools More, featuring more community work, and much more. MooTools FTW!</p>
The HTML above features a paragraph of content with a SPAN tag wrapping what I’d like to be the pull quote.
.quote { padding:20px; margin:0 0 20px 20px; font-size:20px; font-style:italic; background:#eee; color:#999; display:block; width:200px; float:right; }
You may style the quote any way you’d like. These elements are traditionally large in text with italicized text and a different background color.
window.addEvent('domready',function() {
//grab all quotes
$$('span.pull-me').each(function(span) {
//inject styled quote into page
new Element('span',{
'class': 'quote',
text: span.get('text')
}).inject(span.getParent(),'top');
});
});
We find each element with a “pull-me” CSS class and generate a new element with our “quote” class. We then inject the new element into the original element’s parent. That’s all!
Chris did a great job with the execution of his idea. This is a technique that will likely be used well into the future.
Don’t forget to follow me on Twitter and be sure to visit Script & Style for the best Javascript and CSS articles around!
Sponsor the David Walsh Blog and get your brand in front of several thousand users per day!
Better Pull Quotes with MooTools
Related posts:
This blog delivers stylish and dynamic news for designers and web-developers on all subjects of design, ranging from: CSS, Ajax, Javascript, web design, graphics, typography, advertising & much more. Our goal is to help you communicate effectively on the web with an engaging website or functional interface.



