Return to Snippet

Revision: 24850
at March 12, 2010 10:39 by MikeyLikesIt


Updated Code
/*  this function adds Curly Quotes around the content of the specified html container.  */
$(document).ready(function() {
    // Curly Quotes by Michael Thorne
    // Go through each element from the quote field with a class of "quote-wrapper".  This can be adjusted to any HTML selector you choose, including blockquote elements.
    $('.quote-wrapper').each(function() {
        // Get the text of the span
        $(this).prepend('<span class="bq-start">�</span>');
        $(this).append('<span class="bq-end">�</span>');
      }
    );
    // End Curly Quote code
  }
);


/* styles for curly quotes */
.bq-start, .bq-end  {
  position:absolute;
  display:block;
  z-index:-5;
  color:#CCCCCC;
  font-size:4.5em;
}
.bq-start {
  left:-10px;
  top:10px
}
.bq-end {
  right:0px;
  bottom:-0.4em;
}
/*  since we are using absolute positioning for the quotes, the wrapper needs to be position:relative.  */
blockquote, .quote-wrapper {
 z-index:10;
 position:relative;
}

Revision: 24849
at March 12, 2010 10:34 by MikeyLikesIt


Updated Code
/*  this function adds Curly Quotes around the content of the specified html container.  */
$(document).ready(function() {
    // Curly Quotes by Michael Thorne
    // Go through each element from the quote field with a classname of "views-field-field-quote-value"
    $('.views-field-field-quote-value .field-content').each(function() {
        // Get the text of the span
        $(this).prepend('<span class="bq-start">�</span>');
        $(this).append('<span class="bq-end">�</span>');
      }
    );
    // End Curly Quote code
  }
);


/* styles for curly quotes */
.bq-start, .bq-end  {
  position:absolute;
  display:block;
  z-index:-5;
  color:#CCCCCC;
  font-size:4.5em;
}
.bq-start {
  left:-10px;
  top:10px
}
.bq-end {
  right:0px;
  bottom:-0.4em;
}
.views-field-field-quote-value {
 position:relative;
}
.views-field-field-quote-value .field-content {
 z-index:10;
 position:relative;
}

Revision: 24848
at March 12, 2010 10:32 by MikeyLikesIt


Initial Code
/*  this function adds Curly Quotes around the content of the specified html container.  */
$(document).ready(function() {
    // Curly Quotes by Michael Thorne
    // Go through each element from the quote field with a classname of "views-field-field-quote-value"
    $('.views-field-field-quote-value .field-content').each(function() {
        // Get the text of the span
        $(this).prepend('<span class="bq-start">“</span>');
        $(this).append('<span class="bq-end">”</span>');
      }
    );
    // End Curly Quote code
  }
);


/* styles for curly quotes */
.bq-start, .bq-end  {
  position:absolute;
  display:block;
  z-index:-5;
  color:#CCCCCC;
  font-size:4.5em;
}
.bq-start {
  left:-10px;
  top:10px
}
.bq-end {
  right:0px;
  bottom:-0.4em;
}
.views-field-field-quote-value {
 position:relative;
}
.views-field-field-quote-value .field-content {
 z-index:10;
 position:relative;
}

Initial URL


Initial Description
This is a method that I use to easily wrap an HTML container with nice curly quotes.  I much prefer this method over using images because the quotes can be easily stylized using css fonts, colors, and sizes.  Also, the markup is semantically correct.

Initial Title
Curly Quotes using jQuery and CSS - pullquotes, blockquotes, and more...

Initial Tags
css, textmate, jquery

Initial Language
jQuery