I use this code to highlight my span tag by a specific time
HTML:
<span id="test">The word "fractal" often has different
connotations for laypeople than mathematicians, where the
layperson is more likely to be familiar with fractal art
than a mathematical conception. The mathematical concept
is difficult to formally define even for mathematicians,
but key features can be understood with little mathematical background.</span>
JavaScript:
$(document).ready(function(){
var seconds = 7;
var el = $('span#test');
var width = el.outerWidth();
var height = el.outerHeight();
var wrapper = $('<div>').css({
width: width + 'px',
height: height + 'px',
position: 'relative'
});
var background = $('<div>').css({
width: 0,
height: height + 'px',
position: 'absolute',
background: '#0f0'
});
wrapper.append(background);
wrapper.append(el.css('position','absolute'));
$('body').append(wrapper);
background.animate({width: '+=' + width},1000*seconds);
});
Demo: http://jsfiddle.net/9UgEF/8/
every thing is OK,but i want to highlight span tag
sequential(it's highlight all line together,i want to highlight lines sequential(when first line highlight finished go to next line and ...)) .
How can i do it?