I'm looking to create an animation effect on the last line of a paragraph which is wrapped in a div. It has some links in them so it looks a little like this:
<div id="wrapper"><p>Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Integer eu dui et erat</p></div>
So where ever the last line break happens on page load, I want to select the last line with a span to give it the effect.
I would love not to have to use jQuery even though I may need to...
while you tagged jquery .. this is a jquery code .. but be sure to include jquery first
DEMO
another DEMO with slideDown effect
Try using
.textContent
String.prototype.split()
withRegExp
/\n/
,Array.prototype.slice()
with parameter-1
to select last new line character ,String.prototype.replace()
to replace selected text withindiv
withspan
element having selected text