It is well known that the article consists of several lines.
To enable the reader to distinguish the line that reads it , so i want when hover on line from text or articles While reading change background color?
for know all text it between <p></p>
Asked
Active
Viewed 25 times
-2

tarek
- 17
- 5
-
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. – Paulie_D Feb 10 '16 at 15:55
1 Answers
0
You can do it with javascript
add jQuery 1.9.1
JSFIDDLE Example Is Here
Javascript code :
var $div = $("<div>"),
$marker = $("<div>"),
adder = [],
$p = $("p"),
$line = $("<span>").appendTo($marker),
lastWord = '';
$marker.css({'position': 'fixed', 'top': '100%'}).appendTo("body");
$p.text().split(/\s/).forEach(function (elem) {
$line.text($line.text() + elem + ' ');
if ($line.width() > $p.width()) {
$line.text(function (_, text) {
return text.slice(0, text.lastIndexOf(elem));
});
$line.appendTo($div);
console.log($line.text());
$line = $("<span>");
$line.text(' ' + elem).appendTo($marker);
console.log($marker.html() + "END");
}
});
$div.append($marker.html());
$p.html($div.html());
$div.remove();
$marker.remove();

Dr Manish Lataa-Manohar Joshi
- 2,380
- 5
- 17
- 38