PluginProbe
oik / 2.4
oik v2.4
1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.2 1.3 1.3.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.0.1 2.1 2.2 2.3 2.4 2.5 2.5.1 All 71 releases
oik / shortcodes / jquery / jquery.pullquote.js

jquery.pullquote.js in oik 2.4, at shortcodes/jquery/jquery.pullquote.js

75 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 *
3 * jQuery pullquote
4 *
5 * (C) Copyright Bobbing Wide 2013
6 *
7 * Free to use under the GPLv2 license.
8 * http://www.gnu.org/licenses/gpl-2.0.html
9 *
10 * Based on:
11 * @link http://brettterpstra.com/share/pully/pully.jquery.js
12 * @link https://www.inkling.com/read/javascript-jquery-david-sawyer-mcfarland-2nd/chapter-4/automatic-pull-quotes
13 * @link http://css-tricks.com/better-pull-quotes/
14 *
15 * Example usage in oik shortcodes.
16 *
17 * [bw_css] .pullquote { float: right; }
18 * [/bw_css]
19 *
20 * [bw_jq span.pq pullquote]
21 * some interesting stuff
22 * <span class=pq>This will appear in a pull quote</pq>
23 * some more interesting stuff
24 * [bw_jq span.pq pullquote class="pullquote-left"]
25 *
26 */
27 (function( $ ){
28 $.fn.pullquote = function(options) {
29 var settings = {
30 'class' : 'pullquote', // new class to apply to the inserted span
31 'prependto' : 'p', // or selector, e.g. 'p' or '.section'
32 'inline' : false // set to true when you want the pull quote to be inline, rather than prepended to the parent tag.
33 };
34 return this.each(function(){
35 if (options) {
36 $.extend(settings,options);
37 }
38 if ( settings.inline ) {
39 var $prependto = $(this );
40 } else {
41 var $prependto = $(this).closest( settings.prependto );
42 // $prependto.css('position', 'relative' );
43 }
44 $(this).clone().addClass( settings.class).prependTo( $prependto );
45 });
46 };
47 })( jQuery );
48
49
50 /** Chris Coyier's code puts the pull quote at the beginning of the paragraph
51 Brett's allows you to select where to put it e.g. prependtoparent=.section - but that's a bit trickier
52 David Sawyer McFarland's put it inline -
53
54 */
55
56 /**
57 $(document).ready(function() {
58 $('span.pull-right').each(function(index) {
59 var $parentParagraph = $(this).parent('p');
60 $parentParagraph.css('position', 'relative');
61 $(this).clone()
62 .addClass('pulled-right')
63 .prependTo($parentParagraph);
64 });
65 $('span.pull-left').each(function(index) {
66 var $parentParagraph = $(this).parent('p');
67 $parentParagraph.css('position', 'relative');
68 $(this).clone()
69 .addClass('pulled-left')
70 .prependTo($parentParagraph);
71 });
72 });
73
74 */
75