Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 62 lines (42 sloc) 1.323 kB
a5946ec @JeffreyWay First draft of plugin
authored
1 # jQuery Stylewords
2
8d31c54 @JeffreyWay Updated readme
authored
3 For the times when you wish that CSS had a :first-word(x) psuedo-class.
a5946ec @JeffreyWay First draft of plugin
authored
4
5 ## Getting Started
6 Download the [production version][min] or the [development version][max].
7
8d31c54 @JeffreyWay Updated readme
authored
8 [min]: https://raw.github.com/jeffreyway/jquery.styleWords/master/dist/jquery.styleWords.min.js
9 [max]: https://raw.github.com/jeffreyway/jquery.styleWords/master/dist/jquery.styleWords.js
a5946ec @JeffreyWay First draft of plugin
authored
10
11 In your web page:
12
13 ```html
8d31c54 @JeffreyWay Updated readme
authored
14 <p>Lorem ipsum dolor sit amet.</p>
a5946ec @JeffreyWay First draft of plugin
authored
15 <script src="jquery.js"></script>
16 <script src="dist/jquery.styleWords.min.js"></script>
17 <script>
18 jQuery(function($) {
8d31c54 @JeffreyWay Updated readme
authored
19 $('p').styleWords(2);
a5946ec @JeffreyWay First draft of plugin
authored
20 });
21 </script>
22 ```
23
8d31c54 @JeffreyWay Updated readme
authored
24 This will turn the paragraph into:
25
26 ```html
27 <p><span class="styleWords">Lorem ipsum</span> dolor sit amet.</p>
28 ```
29
30 At this point, you have your CSS hook. Style those first few words however you wish!
a5946ec @JeffreyWay First draft of plugin
authored
31
32 ## Examples
33
8d31c54 @JeffreyWay Updated readme
authored
34 ### Easiest Usage
35
36 // Filter through collection, and wrap the
37 // first word in a span.
38 $('p').styleWords();
39
40
41 // Wrap the first three words in a span
42 $('p').styleWords(3);
43
44
45 // Wrap the first two words, and use a `strong` tag instead.
46 $('p').styleWords(2, {
47 tag: '<strong>'
48 });
49
a5946ec @JeffreyWay First draft of plugin
authored
50
8d31c54 @JeffreyWay Updated readme
authored
51 // Apply a custom classname
52 $('p').styleWords(2, {
53 'class': 'my-custom-class'
54 });
a5946ec @JeffreyWay First draft of plugin
authored
55
56 ## Release History
8d31c54 @JeffreyWay Updated readme
authored
57 - 0.1.0 - First draft of plugin.
a5946ec @JeffreyWay First draft of plugin
authored
58
59 ## License
60 Copyright (c) 2012 Jeffrey Way
61 Licensed under the GPL license.
Something went wrong with that request. Please try again.