152 |
jQuery splitLines() demos
153 |
154 | splitLines() takes a block of text and splits it up into separate lines based on the width of the box or a width passed to the function.
155 |
156 |
157 | splitLines()
158 |
159 | - width string The width of the box. By default, it tries to use the element's width. If you don't define a width, there's no way to split it by lines!
160 | - tag string The tag to wrap the lines in
161 | - keepHtml boolean Whether or not to try and preserve the html within the element. Default is true
162 |
163 |
164 |
165 |
Example of text split by lines
166 |
167 | This is an example of some long text that we want to split into lines.
168 |
169 |
170 | This is an example of some long text that we want to split into lines.
171 |
172 |
173 |
174 |
Example of text split by lines using span tags and a defined width
175 |
176 | This is an example of some long text that we want to split into lines. We also set it
177 | to use a span tag and defined the width instead of using the original's width.
178 |
179 |
180 | This is an example of some long text that we want to split into lines. We also set it
181 | to use a span tag and defined the width instead of using the original's width.
182 |
183 |
184 |
185 |
Example of text split by lines with a larger font
186 |
187 | This is an example of some long and large text that we want to split into lines.
188 |
189 |
190 | This is an example of some long and large text that we want to split into lines.
191 |
192 |
193 |
194 |
Example of text split with a line height
195 |
196 | My line height is smaller than my ascendors and descendors!
197 |
198 |
199 | My line height is smaller than my ascendors and descendors!
200 |
201 |
202 |
203 |
Example of text that contains html
204 |
205 | Notice how the strong and emphasized tags are maintained during split.
206 |
207 |
208 | Notice how the strong and emphasized tags are maintained during split.
209 |
210 |
211 |
212 |
Example of text split by lines, and cycling through each other
213 |
214 | Here's a spiffy fading example use case for splitLines().
215 |
216 |
217 |
218 |
Another animation example
219 |
220 | And a sliding example using splitLines() to split into equal chunks! Isn't it neat?
221 |
222 |
223 |
224 |
A test for using a width that's entirely too small
225 |
226 | Long words will not fit into small widths!
227 |
228 |
229 |
230 |
231 |
A test for preserving <br>
tags.
232 |
233 | Broken up
with html line
breaks but still with split lines.
234 | How about words in tags
with brs!
235 |
236 |
237 |
238 |
239 |
A test using the width of an outer container
240 |
241 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu. Fusce erat urna, blandit sed ex sit amet, sollicitudin pellentesque ex.
242 |
243 |
244 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu. Fusce erat urna, blandit sed ex sit amet, sollicitudin pellentesque ex.
245 |
246 |
247 |
248 |
249 |
A test using --line-index
CSS variable to animate lines.
250 |
251 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
252 |
253 |
254 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
255 |
256 |
257 |
258 |
259 |
A test using --line-index
CSS variable and extra tag wrappers to animate lines.
260 |
261 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
262 |
263 |
264 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
265 |
266 |
267 |
268 |
269 |
A test showing the plugin works with a selector that returns multiple nodes.
270 |
271 |
272 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
273 |
274 |
275 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
276 |
277 |
278 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
279 |
280 |
281 |
282 |
283 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
284 |
285 |
286 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
287 |
288 |
289 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sodales est libero, eget convallis mauris viverra eu.
290 |
291 |
292 |
293 |